diff options
author | Nicolas George <george@nsup.org> | 2014-04-21 11:01:10 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2014-04-29 13:24:11 +0200 |
commit | b804eb4323a01f55727ac48475a9e3c257532ab5 (patch) | |
tree | a018de97b33ffc73263f1e7a30c9137f3b49d30f /libavutil/hash.h | |
parent | 5b881499a8e40ad0aa3424ec4d9adeb8008c4189 (diff) | |
download | ffmpeg-b804eb4323a01f55727ac48475a9e3c257532ab5.tar.gz |
lavu/hash: add hash_final helpers.
The helpers use local memory to compute the final hash,
making AV_HASH_MAX_SIZE safe to use.
Diffstat (limited to 'libavutil/hash.h')
-rw-r--r-- | libavutil/hash.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libavutil/hash.h b/libavutil/hash.h index 9bf715e1ac..d4bcbf8cc8 100644 --- a/libavutil/hash.h +++ b/libavutil/hash.h @@ -83,6 +83,28 @@ void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); /** + * Finalize a hash context and compute the actual hash value. + * If size is smaller than the hash size, the hash is truncated; + * if size is larger, the buffer is padded with 0. + */ +void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a hex string. + * The string is always 0-terminated. + * If size is smaller than 2 * hash_size + 1, the hex string is truncated. + */ +void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a base64 string. + * The string is always 0-terminated. + * If size is smaller than AV_BASE64_SIZE(hash_size), the base64 string is + * truncated. + */ +void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** * Free hash context. */ void av_hash_freep(struct AVHashContext **ctx); |