30 lines
979 B
C
30 lines
979 B
C
/**
|
|
* @file crypt/md5.h
|
|
* @brief DI-net MD5 implementation used by HMAC-MD5
|
|
* @date 7 January 2015
|
|
* @author ing. R.W.A. van der Heijden
|
|
* @copyright 2015 Dual Inventive B.V.
|
|
*
|
|
* Implementation of the MD5 hash algorithm as described in RFC 1321
|
|
*/
|
|
#ifndef DI_CRYPT_MD5_H_
|
|
#define DI_CRYPT_MD5_H_
|
|
|
|
#define DI_CRYPT_MD5_HASH_BITS 128
|
|
#define DI_CRYPT_MD5_HASH_BYTES (DI_CRYPT_MD5_HASH_BITS / 8)
|
|
#define DI_CRYPT_MD5_BLOCK_BITS 512
|
|
#define DI_CRYPT_MD5_BLOCK_BYTES (DI_CRYPT_MD5_BLOCK_BITS / 8)
|
|
|
|
struct di_crypt_md5_ctx {
|
|
uint32_t a[4];
|
|
uint32_t counter;
|
|
};
|
|
|
|
void di_crypt_md5_init(struct di_crypt_md5_ctx *s);
|
|
void di_crypt_md5_next_block(struct di_crypt_md5_ctx *state, const void *block);
|
|
void di_crypt_md5_last_block(struct di_crypt_md5_ctx *state, const void *block, uint16_t length);
|
|
void di_crypt_md5_ctx2hash(uint8_t *digest, const struct di_crypt_md5_ctx *state);
|
|
void di_crypt_md5(const void *msg, size_t length, uint8_t *digest);
|
|
|
|
#endif /* DI_CRYPT_MD5_H_ */
|