diff options
author | James Almer <jamrial@gmail.com> | 2013-06-15 21:29:07 -0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-16 12:49:39 +0200 |
commit | 4a0d603072a5064f0f464c975a5b2493dced6913 (patch) | |
tree | 647644889a1fc96e624c400e9574c2ad16613115 /libavutil | |
parent | 8962da9ec367b535f975c876643ed2cad2bad32e (diff) | |
download | ffmpeg-4a0d603072a5064f0f464c975a5b2493dced6913.tar.gz |
lavu/hash: Add support for RIPEMD
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/hash.c | 25 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/libavutil/hash.c b/libavutil/hash.c index 11d8d05b72..a8cf80b577 100644 --- a/libavutil/hash.c +++ b/libavutil/hash.c @@ -24,6 +24,7 @@ #include "crc.h" #include "md5.h" #include "murmur3.h" +#include "ripemd.h" #include "sha.h" #include "sha512.h" @@ -35,6 +36,10 @@ enum hashtype { MD5, MURMUR3, + RIPEMD128, + RIPEMD160, + RIPEMD256, + RIPEMD320, SHA160, SHA224, SHA256, @@ -60,6 +65,10 @@ struct { } hashdesc[] = { [MD5] = {"MD5", 16}, [MURMUR3] = {"murmur3", 16}, + [RIPEMD128] = {"RIPEMD128", 16}, + [RIPEMD160] = {"RIPEMD160", 20}, + [RIPEMD256] = {"RIPEMD256", 32}, + [RIPEMD320] = {"RIPEMD320", 40}, [SHA160] = {"SHA160", 20}, [SHA224] = {"SHA224", 28}, [SHA256] = {"SHA256", 32}, @@ -102,6 +111,10 @@ int av_hash_alloc(AVHashContext **ctx, const char *name) switch (i) { case MD5: res->ctx = av_md5_alloc(); break; case MURMUR3: res->ctx = av_murmur3_alloc(); break; + case RIPEMD128: + case RIPEMD160: + case RIPEMD256: + case RIPEMD320: res->ctx = av_ripemd_alloc(); break; case SHA160: case SHA224: case SHA256: res->ctx = av_sha_alloc(); break; @@ -125,6 +138,10 @@ void av_hash_init(AVHashContext *ctx) switch (ctx->type) { case MD5: av_md5_init(ctx->ctx); break; case MURMUR3: av_murmur3_init(ctx->ctx); break; + case RIPEMD128: av_ripemd_init(ctx->ctx, 128); break; + case RIPEMD160: av_ripemd_init(ctx->ctx, 160); break; + case RIPEMD256: av_ripemd_init(ctx->ctx, 256); break; + case RIPEMD320: av_ripemd_init(ctx->ctx, 320); break; case SHA160: av_sha_init(ctx->ctx, 160); break; case SHA224: av_sha_init(ctx->ctx, 224); break; case SHA256: av_sha_init(ctx->ctx, 256); break; @@ -142,6 +159,10 @@ void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len) switch (ctx->type) { case MD5: av_md5_update(ctx->ctx, src, len); break; case MURMUR3: av_murmur3_update(ctx->ctx, src, len); break; + case RIPEMD128: + case RIPEMD160: + case RIPEMD256: + case RIPEMD320: av_ripemd_update(ctx->ctx, src, len); break; case SHA160: case SHA224: case SHA256: av_sha_update(ctx->ctx, src, len); break; @@ -159,6 +180,10 @@ void av_hash_final(AVHashContext *ctx, uint8_t *dst) switch (ctx->type) { case MD5: av_md5_final(ctx->ctx, dst); break; case MURMUR3: av_murmur3_final(ctx->ctx, dst); break; + case RIPEMD128: + case RIPEMD160: + case RIPEMD256: + case RIPEMD320: av_ripemd_final(ctx->ctx, dst); break; case SHA160: case SHA224: case SHA256: av_sha_final(ctx->ctx, dst); break; diff --git a/libavutil/version.h b/libavutil/version.h index 6013fa17cc..5d4efd6953 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -76,7 +76,7 @@ #define LIBAVUTIL_VERSION_MAJOR 52 #define LIBAVUTIL_VERSION_MINOR 37 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ |