Skip to content
Snippets Groups Projects
Commit c55c715c authored by James Almer's avatar James Almer Committed by Michael Niedermayer
Browse files

lavu/hash: Fix adler32 calculation


Adler must be initialized with a non zero value.

Signed-off-by: default avatarJames Almer <jamrial@gmail.com>
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent 42af97db
No related branches found
No related tags found
No related merge requests found
...@@ -115,8 +115,8 @@ void av_hash_init(AVHashContext *ctx) ...@@ -115,8 +115,8 @@ void av_hash_init(AVHashContext *ctx)
case SHA160: av_sha_init(ctx->ctx, 160); break; case SHA160: av_sha_init(ctx->ctx, 160); break;
case SHA224: av_sha_init(ctx->ctx, 224); break; case SHA224: av_sha_init(ctx->ctx, 224); break;
case SHA256: av_sha_init(ctx->ctx, 256); break; case SHA256: av_sha_init(ctx->ctx, 256); break;
case CRC32: case CRC32: ctx->crc = 0; break;
case ADLER32: ctx->crc = 0; break; case ADLER32: ctx->crc = 1; break;
} }
} }
...@@ -141,8 +141,8 @@ void av_hash_final(AVHashContext *ctx, uint8_t *dst) ...@@ -141,8 +141,8 @@ void av_hash_final(AVHashContext *ctx, uint8_t *dst)
case SHA160: case SHA160:
case SHA224: case SHA224:
case SHA256: av_sha_final(ctx->ctx, dst); break; case SHA256: av_sha_final(ctx->ctx, dst); break;
case CRC32: case CRC32: AV_WL32(dst, ctx->crc); break;
case ADLER32: AV_WL32(dst, ctx->crc); break; case ADLER32: AV_WB32(dst, ctx->crc); break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment