Initial Commit
[Projects.git] / pkgbuilds / friidump / src / friidump-0.4.0 / friidump-0.4.0 / libmultihash / md4.h
blobc0cb3430ac163bdea779acc1c51c7828e4c9cd46
1 /**
2 * \file md4.h
3 */
4 #ifndef _MD4_H
5 #define _MD4_H
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 /**
12 * \brief MD4 context structure
14 typedef struct
16 unsigned long total[2]; /*!< number of bytes processed */
17 unsigned long state[4]; /*!< intermediate digest state */
18 unsigned char buffer[64]; /*!< data block being processed */
19 unsigned char ipad[64]; /*!< HMAC: inner padding */
20 unsigned char opad[64]; /*!< HMAC: outer padding */
22 md4_context;
24 /**
25 * \brief MD4 context setup
27 * \param ctx context to be initialized
29 void md4_starts( md4_context *ctx );
31 /**
32 * \brief MD4 process buffer
34 * \param ctx MD4 context
35 * \param input buffer holding the data
36 * \param ilen length of the input data
38 void md4_update( md4_context *ctx, unsigned char *input, int ilen );
40 /**
41 * \brief MD4 final digest
43 * \param ctx MD4 context
44 * \param output MD4 checksum result
46 void md4_finish( md4_context *ctx, unsigned char *output );
48 /**
49 * \brief Output = MD4( input buffer )
51 * \param input buffer holding the data
52 * \param ilen length of the input data
53 * \param output MD4 checksum result
55 void md4( unsigned char *input, int ilen,
56 unsigned char *output );
58 /**
59 * \brief Output = MD4( file contents )
61 * \param path input file name
62 * \param output MD4 checksum result
64 * \return 0 if successful, 1 if fopen failed,
65 * or 2 if fread failed
67 int md4_file( char *path, unsigned char *output );
69 /**
70 * \brief MD4 HMAC context setup
72 * \param ctx HMAC context to be initialized
73 * \param key HMAC secret key
74 * \param keylen length of the HMAC key
76 void md4_hmac_starts( md4_context *ctx,
77 unsigned char *key, int keylen );
79 /**
80 * \brief MD4 HMAC process buffer
82 * \param ctx HMAC context
83 * \param input buffer holding the data
84 * \param ilen length of the input data
86 void md4_hmac_update( md4_context *ctx,
87 unsigned char *input, int ilen );
89 /**
90 * \brief MD4 HMAC final digest
92 * \param ctx HMAC context
93 * \param output MD4 HMAC checksum result
95 void md4_hmac_finish( md4_context *ctx, unsigned char *output );
97 /**
98 * \brief Output = HMAC-MD4( hmac key, input buffer )
100 * \param key HMAC secret key
101 * \param keylen length of the HMAC key
102 * \param input buffer holding the data
103 * \param ilen length of the input data
104 * \param output HMAC-MD4 result
106 void md4_hmac( unsigned char *key, int keylen,
107 unsigned char *input, int ilen,
108 unsigned char *output );
111 * \brief Checkup routine
113 * \return 0 if successful, or 1 if the test failed
115 int md4_self_test( int verbose );
117 #ifdef __cplusplus
119 #endif
121 #endif /* md4.h */