/*
 * This is an OpenSSL-compatible implementation of the RSA Data Security,
 * Inc. MD5 Message-Digest Algorithm (RFC 1321).
 *
 * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
 * the public domain.  See md5.c for more information.
 *
 * The interface deliberately matches md4.h, which is the same author's
 * code and is already used here for the NT password hash.
 *   Portions Copyright RISC OS Developments 2019+, credited to the RISC OS One Project.
 */

#ifndef __MD5_H
#define __MD5_H

#include <stdlib.h>

#define	MD5_RESULTLEN (128/8)

typedef unsigned int md5_uint32;

struct md5_context {
	md5_uint32 lo, hi;
	md5_uint32 a, b, c, d;
	unsigned char buffer[64];
	md5_uint32 block[16];
};

void md5_init(struct md5_context *ctx);
void md5_update(struct md5_context *ctx, const void *data, size_t size);
void md5_final(struct md5_context *ctx, unsigned char result[MD5_RESULTLEN]);

void md5_get_digest(const void *data, size_t size,
		    unsigned char result[MD5_RESULTLEN]);

void hmac_md5(const unsigned char *key, size_t key_len,
	      const void *data, size_t size,
	      unsigned char result[MD5_RESULTLEN]);
/*
    Keyed hash as RFC 2104, which is what every part of NTLMv2 is built
    from.  A key longer than the 64 byte block is hashed down first.
*/

#endif
