plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

md4test.c (537B)


      1 #include "os.h"
      2 #include <mp.h>
      3 #include <libsec.h>
      4 
      5 char *tests[] = {
      6 	"",
      7 	"a",
      8 	"abc",
      9 	"message digest",
     10 	"abcdefghijklmnopqrstuvwxyz",
     11 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
     12 	"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
     13 	0
     14 };
     15 
     16 void
     17 main(void)
     18 {
     19 	char **pp;
     20 	uchar *p;
     21 	int i;
     22 	uchar digest[MD5dlen];
     23 
     24 	for(pp = tests; *pp; pp++){
     25 		p = (uchar*)*pp;
     26 		md4(p, strlen(*pp), digest, 0);
     27 		for(i = 0; i < MD5dlen; i++)
     28 			print("%2.2ux", digest[i]);
     29 		print("\n");
     30 	}
     31 }