md4.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* $OpenBSD: md4.h,v 1.14 2004/05/03 17:30:14 millert Exp $ */
  2. /*
  3. * This code implements the MD4 message-digest algorithm.
  4. * The algorithm is due to Ron Rivest. This code was
  5. * written by Colin Plumb in 1993, no copyright is claimed.
  6. * This code is in the public domain; do with it what you wish.
  7. * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
  8. *
  9. * Equivalent code is available from RSA Data Security, Inc.
  10. * This code has been tested against that, and is equivalent,
  11. * except that you don't need to include two pages of legalese
  12. * with every copy.
  13. */
  14. #ifndef _MD4_H_
  15. #define _MD4_H_
  16. #include <sys/types.h>
  17. #include <stdint.h>
  18. #define MD4_BLOCK_LENGTH 64
  19. #define MD4_DIGEST_LENGTH 16
  20. #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1)
  21. typedef struct MD4Context {
  22. uint32_t state[4]; /* state */
  23. uint64_t count; /* number of bits, mod 2^64 */
  24. uint8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
  25. } MD4_CTX;
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. void MD4Init(MD4_CTX *);
  30. void MD4Update(MD4_CTX *, const uint8_t *, size_t);
  31. void MD4Pad(MD4_CTX *);
  32. void MD4Final(uint8_t [MD4_DIGEST_LENGTH], MD4_CTX *);
  33. void MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH]);
  34. char *MD4End(MD4_CTX *, char *);
  35. char *MD4File(const char *, char *);
  36. char *MD4FileChunk(const char *, char *, off_t, off_t);
  37. char *MD4Data(const uint8_t *, size_t, char *);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* _MD4_H_ */