Go to the documentation of this file.
32 #define MAX_HASHLEN 64
33 #define MAX_BLOCKLEN 128
49 #define DEFINE_SHA(bits) \
50 static av_cold void sha ## bits ##_init(void *ctx) \
52 av_sha_init(ctx, bits); \
55 #define DEFINE_SHA512(bits) \
56 static av_cold void sha ## bits ##_init(void *ctx) \
58 av_sha512_init(ctx, bits); \
84 c->init = sha160_init;
92 c->init = sha224_init;
100 c->init = sha256_init;
108 c->init = sha384_init;
116 c->init = sha512_init;
144 if (keylen >
c->blocklen) {
146 c->update(
c->hash,
key, keylen);
147 c->final(
c->hash,
c->key);
148 c->keylen =
c->hashlen;
150 memcpy(
c->key,
key, keylen);
154 for (
i = 0;
i <
c->keylen;
i++)
156 for (
i =
c->keylen; i < c->blocklen;
i++)
158 c->update(
c->hash,
block,
c->blocklen);
170 if (outlen < c->hashlen)
172 c->final(
c->hash,
out);
174 for (
i = 0;
i <
c->keylen;
i++)
176 for (
i =
c->keylen; i < c->blocklen;
i++)
178 c->update(
c->hash,
block,
c->blocklen);
179 c->update(
c->hash,
out,
c->hashlen);
180 c->final(
c->hash,
out);
185 const uint8_t *
key,
unsigned int keylen,
186 uint8_t *
out,
unsigned int outlen)
#define DEFINE_SHA512(bits)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void av_sha512_final(AVSHA512 *ctx, uint8_t *digest)
Finish hashing and output digest value.
struct AVSHA512 * av_sha512_alloc(void)
Allocate an AVSHA512 context.
void(* hmac_update)(void *ctx, const uint8_t *src, size_t len)
int av_hmac_calc(AVHMAC *c, const uint8_t *data, unsigned int len, const uint8_t *key, unsigned int keylen, uint8_t *out, unsigned int outlen)
Hash an array of data with a key.
int av_hmac_final(AVHMAC *c, uint8_t *out, unsigned int outlen)
Finish hashing and output the HMAC digest.
uint8_t key[MAX_BLOCKLEN]
void(* hmac_final)(void *ctx, uint8_t *dst)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
void av_sha_final(AVSHA *ctx, uint8_t *digest)
Finish hashing and output digest value.
void av_hmac_update(AVHMAC *c, const uint8_t *data, unsigned int len)
Hash data with the HMAC.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
Update hash value.
AVHMAC * av_hmac_alloc(enum AVHMACType type)
Allocate an AVHMAC context.
void av_hmac_free(AVHMAC *c)
Free an AVHMAC context.
struct AVSHA * av_sha_alloc(void)
Allocate an AVSHA context.
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
#define i(width, name, range_min, range_max)
void av_hmac_init(AVHMAC *c, const uint8_t *key, unsigned int keylen)
Initialize an AVHMAC context with an authentication key.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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(* hmac_init)(void *ctx)
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
Update hash value.
The exact code depends on how similar the blocks are and how related they are to the block
void av_sha512_update(AVSHA512 *ctx, const uint8_t *data, size_t len)
Update hash value.