43#define HASHES(ENTRY) \
44 ENTRY(MD5, "MD5", 16) \
45 ENTRY(MURMUR3, "murmur3", 16) \
46 ENTRY(RIPEMD128, "RIPEMD128", 16) \
47 ENTRY(RIPEMD160, "RIPEMD160", 20) \
48 ENTRY(RIPEMD256, "RIPEMD256", 32) \
49 ENTRY(RIPEMD320, "RIPEMD320", 40) \
50 ENTRY(SHA160, "SHA160", 20) \
51 ENTRY(SHA224, "SHA224", 28) \
52 ENTRY(SHA256, "SHA256", 32) \
53 ENTRY(SHA512_224, "SHA512/224", 28) \
54 ENTRY(SHA512_256, "SHA512/256", 32) \
55 ENTRY(SHA384, "SHA384", 48) \
56 ENTRY(SHA512, "SHA512", 64) \
57 ENTRY(CRC32, "CRC32", 4) \
58 ENTRY(ADLER32, "adler32", 4) \
61#define HASH_TYPE(TYPE, NAME, SIZE) TYPE,
73#define HASH_MAX_SIZE(TYPE, NAME, SIZE) \
74 HASH_MAX_SIZE_BEFORE_ ## TYPE, \
75 HASH_MAX_SIZE_UNTIL_ ## TYPE ## _MINUS_ONE = FFMAX(SIZE, HASH_MAX_SIZE_BEFORE_ ## TYPE) - 1,
82#define HASH_MAX_NAME_SIZE(TYPE, NAME, SIZE) \
83 HASH_MAX_NAME_SIZE_BEFORE_ ## TYPE, \
84 HASH_MAX_NAME_SIZE_UNTIL_ ## TYPE ## _MINUS_ONE = FFMAX(sizeof(NAME), HASH_MAX_NAME_SIZE_BEFORE_ ## TYPE) - 1,
94#define HASH_DESC(TYPE, NAME, SIZE) [TYPE] = { NAME, SIZE },
124 if (!res)
return AVERROR(ENOMEM);
143 if (
i != ADLER32 &&
i != CRC32 && !res->
ctx) {
167 case CRC32:
ctx->crc = UINT32_MAX;
break;
168 case ADLER32:
ctx->crc = 1;
break;
222 memset(
dst + rsize, 0,
size - rsize);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Public header for Adler-32 hash function implementation.
static AVFormatContext * ctx
#define i(width, name, range_min, range_max)
Public header for CRC hash function implementation.
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the Base64 representation of the actual hash value as a string.
void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the actual hash value in a buffer.
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the hexadecimal representation of the actual hash value as a string...
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
void av_hash_update(AVHashContext *ctx, const uint8_t *src, size_t len)
Update a hash context with additional data.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
const char * av_hash_names(int i)
Get the names of available hash algorithms.
void av_hash_final(AVHashContext *ctx, uint8_t *dst)
Finalize a hash context and compute the actual hash value.
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
Update hash value.
AVMurMur3 * av_murmur3_alloc(void)
Allocate an AVMurMur3 hash context.
void av_murmur3_update(AVMurMur3 *c, const uint8_t *src, size_t len)
Update hash context with new data.
void av_murmur3_init(AVMurMur3 *c)
Initialize or reinitialize an AVMurMur3 hash context.
void av_murmur3_final(AVMurMur3 *c, uint8_t dst[16])
Finish hashing and output digest value.
void av_ripemd_final(AVRIPEMD *ctx, uint8_t *digest)
Finish hashing and output digest value.
av_cold int av_ripemd_init(AVRIPEMD *ctx, int bits)
Initialize RIPEMD hashing.
void av_ripemd_update(AVRIPEMD *ctx, const uint8_t *data, size_t len)
Update hash value.
struct AVRIPEMD * av_ripemd_alloc(void)
Allocate an AVRIPEMD context.
struct AVSHA512 * av_sha512_alloc(void)
Allocate an AVSHA512 context.
av_cold int av_sha512_init(AVSHA512 *ctx, int bits)
Initialize SHA-2 512 hashing.
void av_sha512_final(AVSHA512 *ctx, uint8_t *digest)
Finish hashing and output digest value.
void av_sha512_update(AVSHA512 *ctx, const uint8_t *data, size_t len)
Update hash value.
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
Update hash value.
struct AVSHA * av_sha_alloc(void)
Allocate an AVSHA context.
void av_sha_final(AVSHA *ctx, uint8_t *digest)
Finish hashing and output digest value.
av_cold int av_sha_init(AVSHA *ctx, int bits)
Initialize SHA-1 or SHA-2 hashing.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
static const struct @154042213135156076277066210352310164342317005367 hashdesc[]
#define HASH_MAX_SIZE(TYPE, NAME, SIZE)
#define HASH_MAX_NAME_SIZE(TYPE, NAME, SIZE)
#define HASH_TYPE(TYPE, NAME, SIZE)
int av_hash_get_size(const AVHashContext *ctx)
#define HASH_DESC(TYPE, NAME, SIZE)
const char * av_hash_get_name(const AVHashContext *ctx)
Public header for MD5 hash function implementation.
Memory handling functions.
Public header for MurmurHash3 hash function implementation.
Public header for RIPEMD hash function implementation.
Public header for SHA-512 implementation.
Public header for SHA-1 & SHA-256 hash function implementations.