added MD5 test vectors
[strongswan.git] / src / libstrongswan / plugins / test_vectors / test_vectors / md5.c
1 /*
2 * Copyright (C) 2009 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the Licenseor (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be usefulbut
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include <crypto/crypto_tester.h>
17
18 /**
19 * MD5 vectors from RFC1321
20 */
21 hasher_test_vector_t md5_1 = {
22 .alg = HASH_MD5, .len = 0,
23 .data = "",
24 .hash = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e"
25 };
26
27 hasher_test_vector_t md5_2 = {
28 .alg = HASH_MD5, .len = 1,
29 .data = "a",
30 .hash = "\x0c\xc1\x75\xb9\xc0\xf1\xb6\xa8\x31\xc3\x99\xe2\x69\x77\x26\x61"
31 };
32
33 hasher_test_vector_t md5_3 = {
34 .alg = HASH_MD5, .len = 3,
35 .data = "abc",
36 .hash = "\x90\x01\x50\x98\x3c\xd2\x4f\xb0\xd6\x96\x3f\x7d\x28\xe1\x7f\x72"
37 };
38
39 hasher_test_vector_t md5_4 = {
40 .alg = HASH_MD5, .len = 14,
41 .data = "message digest",
42 .hash = "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d\x52\x5a\x2f\x31\xaa\xf1\x61\xd0"
43 };
44
45 hasher_test_vector_t md5_5 = {
46 .alg = HASH_MD5, .len = 26,
47 .data = "abcdefghijklmnopqrstuvwxyz",
48 .hash = "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00\x7d\xfb\x49\x6c\xca\x67\xe1\x3b"
49 };
50
51 hasher_test_vector_t md5_6 = {
52 .alg = HASH_MD5, .len = 62,
53 .data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
54 .hash = "\xd1\x74\xab\x98\xd2\x77\xd9\xf5\xa5\x61\x1c\x2c\x9f\x41\x9d\x9f"
55 };
56
57 hasher_test_vector_t md5_7 = {
58 .alg = HASH_MD5, .len = 80,
59 .data = "1234567890123456789012345678901234567890"
60 "1234567890123456789012345678901234567890",
61 .hash = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6\x7a"
62 };
63