8 * \brief MD5 context structure
12 unsigned long total
[2]; /*!< number of bytes processed */
13 unsigned long state
[4]; /*!< intermediate digest state */
14 unsigned char buffer
[64]; /*!< data block being processed */
16 unsigned char ipad
[64]; /*!< HMAC: inner padding */
17 unsigned char opad
[64]; /*!< HMAC: outer padding */
26 * \brief MD5 context setup
28 * \param ctx context to be initialized
30 void md5_starts( md5_context
*ctx
);
33 * \brief MD5 process buffer
35 * \param ctx MD5 context
36 * \param input buffer holding the data
37 * \param ilen length of the input data
39 void md5_update( md5_context
*ctx
, unsigned char *input
, int ilen
);
42 * \brief MD5 final digest
44 * \param ctx MD5 context
45 * \param output MD5 checksum result
47 void md5_finish( md5_context
*ctx
, unsigned char output
[16] );
50 * \brief Output = MD5( input buffer )
52 * \param input buffer holding the data
53 * \param ilen length of the input data
54 * \param output MD5 checksum result
56 void md5( unsigned char *input
, int ilen
, unsigned char output
[16] );
59 * \brief Output = MD5( file contents )
61 * \param path input file name
62 * \param output MD5 checksum result
64 * \return 0 if successful, 1 if fopen failed,
65 * or 2 if fread failed
67 int md5_file( char *path
, unsigned char output
[16] );
70 * \brief MD5 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 md5_hmac_starts( md5_context
*ctx
, unsigned char *key
, int keylen
);
79 * \brief MD5 HMAC process buffer
81 * \param ctx HMAC context
82 * \param input buffer holding the data
83 * \param ilen length of the input data
85 void md5_hmac_update( md5_context
*ctx
, unsigned char *input
, int ilen
);
88 * \brief MD5 HMAC final digest
90 * \param ctx HMAC context
91 * \param output MD5 HMAC checksum result
93 void md5_hmac_finish( md5_context
*ctx
, unsigned char output
[16] );
96 * \brief Output = HMAC-MD5( hmac key, input buffer )
98 * \param key HMAC secret key
99 * \param keylen length of the HMAC key
100 * \param input buffer holding the data
101 * \param ilen length of the input data
102 * \param output HMAC-MD5 result
104 void md5_hmac( unsigned char *key
, int keylen
,
105 unsigned char *input
, int ilen
,
106 unsigned char output
[16] );
109 * \brief Checkup routine
111 * \return 0 if successful, or 1 if the test failed
113 int md5_self_test( int verbose
);