masqmail

annotate src/md5/hmactest.c @ 56:f6a6f55b7b9e

added old manual from the old website it is dated May/July 2000
author meillo@marmaro.de
date Sat, 29 May 2010 21:51:13 +0200
parents 08114f7dcc23
children dcb315792513
rev   line source
meillo@0 1 #include <stdio.h>
meillo@0 2 #include <stdlib.h>
meillo@0 3 #include <sys/time.h>
meillo@0 4 #include <string.h>
meillo@0 5 #include "global.h"
meillo@0 6 #include "md5.h"
meillo@0 7 #include "hmac_md5.h"
meillo@0 8
meillo@10 9 static void
meillo@10 10 pad0_copy(char *d, char *s, int sz)
meillo@0 11 {
meillo@10 12 int i = 0;
meillo@10 13 while (*s && (i < sz)) {
meillo@10 14 *(d++) = *(s++);
meillo@10 15 i++;
meillo@10 16 }
meillo@10 17 while (i <= sz) {
meillo@10 18 *(d++) = 0;
meillo@10 19 i++;
meillo@10 20 }
meillo@0 21 }
meillo@0 22
meillo@10 23 int
meillo@10 24 main()
meillo@0 25 {
meillo@10 26 int i;
meillo@10 27 // unsigned char digest[16];
meillo@10 28 char digest[16];
meillo@10 29 char *msgid = "<1896.697170952@postoffice.reston.mci.net>";
meillo@10 30 char secret[65];
meillo@0 31
meillo@10 32 hmac_md5("<48157.953508124@mail.class-c.net>", 34, "no!SpamAtAll", 12, digest);
meillo@10 33 for (i = 0; i < 16; i++)
meillo@10 34 printf("%x", (unsigned int) digest[i]);
meillo@10 35 printf("\n");
meillo@0 36
meillo@10 37 hmac_md5(msgid, strlen(msgid), "tanstaaftanstaaf", 16, digest);
meillo@10 38 for (i = 0; i < 16; i++)
meillo@10 39 printf("%x", (unsigned int) digest[i]);
meillo@10 40 printf("\n");
meillo@0 41
meillo@10 42 pad0_copy(secret, "tanstaaftanstaaf", 64);
meillo@10 43 hmac_md5(msgid, strlen(msgid), secret, 64, digest);
meillo@10 44 for (i = 0; i < 16; i++)
meillo@10 45 printf("%x", (unsigned int) digest[i]);
meillo@10 46 printf("\n");
meillo@0 47
meillo@10 48 exit(0);
meillo@0 49 }