Mercurial > masqmail
comparison src/md5/hmactest.c @ 366:41958685480d
Switched to `type *name' style
Andrew Koenig's ``C Traps and Pitfalls'' (Ch.2.1) convinced
me that it is best to go with the way C had been designed.
The ``declaration reflects use'' concept conflicts with a
``type* name'' notation. Hence I switched.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 22 Sep 2011 15:07:40 +0200 |
parents | 38f86ae6171b |
children | b27f66555ba8 |
comparison
equal
deleted
inserted
replaced
365:934a223e4ee8 | 366:41958685480d |
---|---|
60 | 60 |
61 | 61 |
62 puts("---- Following are the test vectors from RFC 2104"); | 62 puts("---- Following are the test vectors from RFC 2104"); |
63 | 63 |
64 | 64 |
65 char* d01 = "Hi There"; | 65 char *d01 = "Hi There"; |
66 char k01[16]; | 66 char k01[16]; |
67 for (i=0; i<16; i++) { | 67 for (i=0; i<16; i++) { |
68 k01[i] = 0x0b; | 68 k01[i] = 0x0b; |
69 } | 69 } |
70 printf("9294727a3638bb1c13f48ef8158bfc9d (should be)\n"); | 70 printf("9294727a3638bb1c13f48ef8158bfc9d (should be)\n"); |
73 printf("%.2x", 0xFF & (unsigned int) digest[i]); | 73 printf("%.2x", 0xFF & (unsigned int) digest[i]); |
74 } | 74 } |
75 printf(" (was computed)\n\n"); | 75 printf(" (was computed)\n\n"); |
76 | 76 |
77 | 77 |
78 char* d02 = "what do ya want for nothing?"; | 78 char *d02 = "what do ya want for nothing?"; |
79 char* k02 = "Jefe"; | 79 char *k02 = "Jefe"; |
80 printf("750c783e6ab0b503eaa86e310a5db738 (should be)\n"); | 80 printf("750c783e6ab0b503eaa86e310a5db738 (should be)\n"); |
81 hmac_md5(d02, strlen(d02), k02, strlen(k02), digest); | 81 hmac_md5(d02, strlen(d02), k02, strlen(k02), digest); |
82 for (i = 0; i < 16; i++) { | 82 for (i = 0; i < 16; i++) { |
83 printf("%.2x", 0xFF & (unsigned int) digest[i]); | 83 printf("%.2x", 0xFF & (unsigned int) digest[i]); |
84 } | 84 } |