Loading...
Searching...
No Matches
HMAC
libavutil » Crypto and Hashing

## Typedefs

typedef struct AVHMAC | AVHMAC

## Enumerations

enum | AVHMACType { AV_HMAC_MD5 , AV_HMAC_SHA1 , AV_HMAC_SHA224 , AV_HMAC_SHA256 , AV_HMAC_SHA384 , AV_HMAC_SHA512 }

## Functions

AVHMAC * | av_hmac_alloc (enum AVHMACType type)
| Allocate an AVHMAC context.
void | av_hmac_free (AVHMAC *ctx)
| Free an AVHMAC context.
void | av_hmac_init (AVHMAC *ctx, const uint8_t *key, unsigned int keylen)
| Initialize an AVHMAC context with an authentication key.
void | av_hmac_update (AVHMAC *ctx, const uint8_t *data, unsigned int len)
| Hash data with the HMAC.
int | av_hmac_final (AVHMAC *ctx, uint8_t *out, unsigned int outlen)
| Finish hashing and output the HMAC digest.
int | av_hmac_calc (AVHMAC *ctx, 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.

## Detailed Description

## Typedef Documentation

## AVHMAC

typedef struct AVHMAC AVHMAC

Definition at line 41 of file hmac.h.

## Enumeration Type Documentation

## AVHMACType

enum AVHMACType

Enumerator
AV_HMAC_MD5 |
AV_HMAC_SHA1 |
AV_HMAC_SHA224 |
AV_HMAC_SHA256 |
AV_HMAC_SHA384 |
AV_HMAC_SHA512 |

Definition at line 32 of file hmac.h.

## Function Documentation

## av_hmac_alloc()

AVHMAC * av_hmac_alloc | ( | enum AVHMACType | type | ) |

Allocate an AVHMAC context.

Parameters

  type | The hash function used for the HMAC.

## av_hmac_free()

void av_hmac_free | ( | AVHMAC * | ctx | ) |

Free an AVHMAC context.

Parameters

  ctx | The context to free, may be NULL

## av_hmac_init()

void av_hmac_init | ( | AVHMAC * | ctx,
|  | const uint8_t * | key,
|  | unsigned int | keylen )

Initialize an AVHMAC context with an authentication key.

Parameters

  ctx | The HMAC context
  key | The authentication key
  keylen | The length of the key, in bytes

## av_hmac_update()

void av_hmac_update | ( | AVHMAC * | ctx,
|  | const uint8_t * | data,
|  | unsigned int | len )

Hash data with the HMAC.

Parameters

  ctx | The HMAC context
  data | The data to hash
  len | The length of the data, in bytes

## av_hmac_final()

int av_hmac_final | ( | AVHMAC * | ctx,
|  | uint8_t * | out,
|  | unsigned int | outlen )

Finish hashing and output the HMAC digest.

Parameters

  ctx | The HMAC context
  out | The output buffer to write the digest into
  outlen | The length of the out buffer, in bytes

Returns
  The number of bytes written to out, or a negative error code.

## av_hmac_calc()

int av_hmac_calc | ( | AVHMAC * | ctx,
|  | 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.

Parameters

  ctx | The HMAC context
  data | The data to hash
  len | The length of the data, in bytes
  key | The authentication key
  keylen | The length of the key, in bytes
  out | The output buffer to write the digest into
  outlen | The length of the out buffer, in bytes

Returns
  The number of bytes written to out, or a negative error code.