Functions

hmac.h File Reference

Routines for computing Hash-based Message Authentication Codes. More...

#include "sha1.h"
#include "md5.h"

Go to the source code of this file.

Functions

int hmac (const char *buffer, int buffer_length, const char *key, int key_length, unsigned char *digest, int digest_len, int block_size, void(*hash_func)(const char *, int, unsigned char *))
 Generate HMAC.
int hmac_md5 (const char *buffer, int buffer_length, const char *key, int key_length, unsigned char digest[MD5_DIGEST_LENGTH])
 Generate HMAC using md5 hash function Note that this function produces a digest in binary form which must be converted to a human readable form with md5_string.
int hmac_sha1 (const char *buffer, int buffer_length, const char *key, int key_length, unsigned char digest[SHA1_DIGEST_LENGTH])
 Generate HMAC using sha1 hash function Note that this function produces a digest in binary form which must be converted to a human readable form with sha1_string.

Detailed Description

Routines for computing Hash-based Message Authentication Codes.


Function Documentation

int hmac ( const char *  buffer,
int  buffer_length,
const char *  key,
int  key_length,
unsigned char *  digest,
int  digest_len,
int  block_size,
void(*)(const char *, int, unsigned char *)  hash_func 
)

Generate HMAC.

Parameters:
buffer Pointer to a memory buffer.
buffer_length Length of the buffer in bytes.
key Pointer to a buffer containing the key for hashing.
key_length The length of the key in bytes.
digest Pointer to a buffer to store the digest.
digest_len The length of the digest buffer.
block_size The size of the block used by the hash function in bytes.
hash_func A function pointer to the hash function to be used.
int hmac_md5 ( const char *  buffer,
int  buffer_length,
const char *  key,
int  key_length,
unsigned char  digest[MD5_DIGEST_LENGTH] 
)

Generate HMAC using md5 hash function Note that this function produces a digest in binary form which must be converted to a human readable form with md5_string.

Parameters:
buffer Pointer to a memory buffer.
buffer_length Length of the buffer in bytes.
key Pointer to a buffer containing the key for hashing.
key_length The length of the key in bytes.
digest Pointer to a buffer of size MD5_DIGEST_LENGTH to store the digest.
int hmac_sha1 ( const char *  buffer,
int  buffer_length,
const char *  key,
int  key_length,
unsigned char  digest[SHA1_DIGEST_LENGTH] 
)

Generate HMAC using sha1 hash function Note that this function produces a digest in binary form which must be converted to a human readable form with sha1_string.

Parameters:
buffer Pointer to a memory buffer.
buffer_length Length of the buffer in bytes.
key Pointer to a buffer containing the key for hashing.
key_length The length of the key in bytes.
digest Pointer to a buffer of size SHA1_DIGEST_LENGTH to store the digest.