masqmail
diff src/md5/hmactest.c @ 10:26e34ae9a3e3
changed indention and line wrapping to a more consistent style
author | meillo@marmaro.de |
---|---|
date | Mon, 27 Oct 2008 16:23:10 +0100 |
parents | 08114f7dcc23 |
children | dcb315792513 |
line diff
1.1 --- a/src/md5/hmactest.c Mon Oct 27 16:21:27 2008 +0100 1.2 +++ b/src/md5/hmactest.c Mon Oct 27 16:23:10 2008 +0100 1.3 @@ -6,41 +6,44 @@ 1.4 #include "md5.h" 1.5 #include "hmac_md5.h" 1.6 1.7 -static 1.8 -void pad0_copy(char *d, char *s, int sz) 1.9 +static void 1.10 +pad0_copy(char *d, char *s, int sz) 1.11 { 1.12 - int i = 0; 1.13 - while(*s && (i < sz)) { *(d++) = *(s++); i++; } 1.14 - while(i <= sz) { *(d++) = 0; i++; } 1.15 + int i = 0; 1.16 + while (*s && (i < sz)) { 1.17 + *(d++) = *(s++); 1.18 + i++; 1.19 + } 1.20 + while (i <= sz) { 1.21 + *(d++) = 0; 1.22 + i++; 1.23 + } 1.24 } 1.25 1.26 -int main() 1.27 +int 1.28 +main() 1.29 { 1.30 - int i; 1.31 - // unsigned char digest[16]; 1.32 - char digest[16]; 1.33 - char *msgid = "<1896.697170952@postoffice.reston.mci.net>"; 1.34 - char secret[65]; 1.35 + int i; 1.36 + // unsigned char digest[16]; 1.37 + char digest[16]; 1.38 + char *msgid = "<1896.697170952@postoffice.reston.mci.net>"; 1.39 + char secret[65]; 1.40 1.41 - hmac_md5("<48157.953508124@mail.class-c.net>", 34, 1.42 - "no!SpamAtAll", 12, digest); 1.43 - for(i = 0; i < 16; i++) 1.44 - printf("%x", (unsigned int)digest[i]); 1.45 - printf("\n"); 1.46 + hmac_md5("<48157.953508124@mail.class-c.net>", 34, "no!SpamAtAll", 12, digest); 1.47 + for (i = 0; i < 16; i++) 1.48 + printf("%x", (unsigned int) digest[i]); 1.49 + printf("\n"); 1.50 1.51 - hmac_md5(msgid, strlen(msgid), 1.52 - "tanstaaftanstaaf", 16, digest); 1.53 - for(i = 0; i < 16; i++) 1.54 - printf("%x", (unsigned int)digest[i]); 1.55 - printf("\n"); 1.56 + hmac_md5(msgid, strlen(msgid), "tanstaaftanstaaf", 16, digest); 1.57 + for (i = 0; i < 16; i++) 1.58 + printf("%x", (unsigned int) digest[i]); 1.59 + printf("\n"); 1.60 1.61 - pad0_copy(secret, "tanstaaftanstaaf", 64); 1.62 - hmac_md5(msgid, strlen(msgid), 1.63 - secret, 64, digest); 1.64 - for(i = 0; i < 16; i++) 1.65 - printf("%x", (unsigned int)digest[i]); 1.66 - printf("\n"); 1.67 + pad0_copy(secret, "tanstaaftanstaaf", 64); 1.68 + hmac_md5(msgid, strlen(msgid), secret, 64, digest); 1.69 + for (i = 0; i < 16; i++) 1.70 + printf("%x", (unsigned int) digest[i]); 1.71 + printf("\n"); 1.72 1.73 - exit(0); 1.74 + exit(0); 1.75 } 1.76 -