2 * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 /* Written by Simon Josefsson. */
29 main (int argc, char *argv[])
31 const char *in1 = "abc";
33 "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde\xd6\xbb";
34 const char *in2 = "abcdefghijklmnopqrstuvwxyz";
36 "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47\x94\x0b";
37 char buf[MD2_DIGEST_SIZE];
39 if (memcmp (md2_buffer (in1, strlen (in1), buf), out1, MD2_DIGEST_SIZE) !=
43 printf ("expected:\n");
44 for (i = 0; i < MD2_DIGEST_SIZE; i++)
45 printf ("%02x ", out1[i] & 0xFF);
46 printf ("\ncomputed:\n");
47 for (i = 0; i < MD2_DIGEST_SIZE; i++)
48 printf ("%02x ", buf[i] & 0xFF);
53 if (memcmp (md2_buffer (in2, strlen (in2), buf), out2, MD2_DIGEST_SIZE) !=
57 printf ("expected:\n");
58 for (i = 0; i < MD2_DIGEST_SIZE; i++)
59 printf ("%02x ", out2[i] & 0xFF);
60 printf ("\ncomputed:\n");
61 for (i = 0; i < MD2_DIGEST_SIZE; i++)
62 printf ("%02x ", buf[i] & 0xFF);