head 1.2; access; symbols; locks; strict; comment @ * @; 1.2 date 2000.01.06.07.29.03; author wessels; state Exp; branches; next 1.1; 1.1 date 2000.01.06.06.07.36; author wessels; state Exp; branches; next ; desc @@ 1.2 log @MD5End() does what md5_print does @ text @/* $Id: md5-filter.c,v 1.1 2000/01/06 06:07:36 wessels Exp wessels $ */ #include #include #include #define MAXLINESZ 4096 int main(int argc, char *argv[]) { char buf[MAXLINESZ]; MD5_CTX M; unsigned char md5[16]; while (fgets(buf, MAXLINESZ, stdin)) { strtok(buf, "\r\n"); MD5Init(&M); MD5Update(&M, (unsigned char *) buf, (unsigned int) strlen(buf)); puts(MD5End(&M, buf)); } } @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* $Id$ */ a8 12 static char * md5_print(unsigned char *md5) { int k = 0; static char buf[33]; int i; for (i = 0; i < 16; i++) snprintf(&buf[k + (i << 1)], 3, "%02x", *(md5 + i)); buf[k + 32] = '\0'; return &buf[k]; } d19 1 a19 2 MD5Final(md5, &M); puts(md5_print(md5)); @