Как создать хэш md5 строки на C?

Я нашел код md5, который состоит из следующих прототипов ...

Я пытался выяснить, где Мне нужно поместить строку, которую я хочу хэшировать, какие функции мне нужно вызвать и где найти строку после ее хеширования. Меня смущает, какие биты uint32 buf [4] и uint32 [2] находятся в структуре.

struct MD5Context {
    uint32 buf[4];
    uint32 bits[2];
    unsigned char in[64];
};

/*
 * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
 * initialization constants.
 */
void MD5Init(struct MD5Context *context);

/*
 * Update context to reflect the concatenation of another buffer full
 * of bytes.
 */
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len);

/*
 * Final wrapup - pad to 64-byte boundary with the bit pattern 
 * 1 0* (64-bit count of bits processed, MSB-first)
 */
void MD5Final(unsigned char digest[16], struct MD5Context *context);

/*
 * The core of the MD5 algorithm, this alters an existing MD5 hash to
 * reflect the addition of 16 longwords of new data.  MD5Update blocks
 * the data and converts bytes into longwords for this routine.
 */
void MD5Transform(uint32 buf[4], uint32 const in[16]);
34
задан Takkun 2 October 2011 в 16:44
поделиться