There's code here.
Also, the openssl libs have md5 functions (from here):
#include <openssl/md5.h>
#include <unistd.h>
int main()
{
int n;
MD5_CTX c;
char buf[512];
ssize_t bytes;
unsigned char out[MD5_DIGEST_LENGTH];
MD5_Init(&c);
bytes=read(STDIN_FILENO, buf, 512);
while(bytes > 0)
{
MD5_Update(&c, buf, bytes);
bytes=read(STDIN_FILENO, buf, 512);
}
MD5_Final(out, &c);
for(n=0; n<MD5_DIGEST_LENGTH; n++)
printf("%02x", out[n]);
printf("
");
return(0);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…