12 * \brief MD4 context structure
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 */
25 * \brief MD4 context setup
27 * \param ctx context to be initialized
29 void md4_starts( md4_context
*ctx
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);