Commit 5c1b6512 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Niels Möller

* testsuite/md4-test.c (test_main): More test vectors, provided by

Daniel Kahn Gillmor.
* testsuite/md5-test.c (test_main): Likewise.
* testsuite/sha1-test.c (test_main): Likewise.
* testsuite/sha256-test.c (test_main): Likewise.
* testsuite/sha384-test.c (test_main): Likewise.
* testsuite/sha512-test.c (test_main): Likewise.

Rev: nettle/testsuite/md4-test.c:1.2
Rev: nettle/testsuite/md5-test.c:1.2
Rev: nettle/testsuite/sha1-test.c:1.2
Rev: nettle/testsuite/sha256-test.c:1.2
Rev: nettle/testsuite/sha384-test.c:1.2
Rev: nettle/testsuite/sha512-test.c:1.2
parent 5e398f9f
......@@ -23,6 +23,16 @@ test_main(void)
LDATA("12345678901234567890123456789012345678901234567890"
"123456789012345678901234567890"),
H("e33b4ddc9c38f2199c3e7b164fcc0536"));
/* Additional test vectors, from Daniel Kahn Gillmor */
test_hash(&nettle_md4, LDATA("38"),
H("ae9c7ebfb68ea795483d270f5934b71d"));
test_hash(&nettle_md4, LDATA("abc"),
H("a448017aaf21d8525fc10ae87aa6729d"));
test_hash(&nettle_md4, LDATA("message digest"),
H("d9130a8164549fe818874806e1c7014b"));
test_hash(&nettle_md4, LDATA("abcdefghijklmnopqrstuvwxyz"),
H("d79e1c308aa5bbcdeea8ed63df412da9"));
SUCCESS();
}
......@@ -30,6 +30,10 @@ test_main(void)
"1234567890123456789012345678901234567890",
H("57EDF4A22BE3C955 AC49DA2E2107B67A"));
/* Additional test vector, from Daniel Kahn Gillmor */
test_hash(&nettle_md5, LDATA("38"),
H("a5771bce93e200c3 6f7cd9dfd0e5deaa"));
/* Collisions, reported by Xiaoyun Wang1, Dengguo Feng2, Xuejia
Lai3, Hongbo Yu1, http://eprint.iacr.org/2004/199. */
......
......@@ -29,6 +29,10 @@ test_main(void)
"1234567890123456789012345678901234567890",
H("50ABF5706A150990 A08B2C5EA40FA0E5 85554732"));
/* Additional test vector, from Daniel Kahn Gillmor */
test_hash(&nettle_sha1, LDATA("38"),
H("5b384ce32d8cdef02bc3a139d4cac0a22bb029e8"));
SUCCESS();
}
......
......@@ -4,6 +4,7 @@
int
test_main(void)
{
/* From FIPS180-2 */
test_hash(&nettle_sha256, 3, "abc",
H("ba7816bf8f01cfea 414140de5dae2223"
"b00361a396177a9c b410ff61f20015ad"));
......@@ -22,5 +23,33 @@ test_main(void)
H("cf5b16a778af8380 036ce59e7b049237"
"0b249b11e8f07a51 afac45037afee9d1"));
SUCCESS();
/* Additional test vectors, from Daniel Kahn Gillmor */
test_hash(&nettle_sha256, LDATA(""),
H("e3b0c44298fc1c14 9afbf4c8996fb924"
"27ae41e4649b934c a495991b7852b855"));
test_hash(&nettle_sha256, LDATA("a"),
H("ca978112ca1bbdca fac231b39a23dc4d"
"a786eff8147c4e72 b9807785afee48bb"));
test_hash(&nettle_sha256, LDATA("38"),
H("aea92132c4cbeb26 3e6ac2bf6c183b5d"
"81737f179f21efdc 5863739672f0f470"));
test_hash(&nettle_sha256, LDATA("message digest"),
H("f7846f55cf23e14e ebeab5b4e1550cad"
"5b509e3348fbc4ef a3a1413d393cb650"));
test_hash(&nettle_sha256, LDATA("abcdefghijklmnopqrstuvwxyz"),
H("71c480df93d6ae2f 1efad1447c66c952"
"5e316218cf51fc8d 9ed832f2daf18b73"));
test_hash(&nettle_sha256,
LDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
"ghijklmnopqrstuvwxyz0123456789"),
H("db4bfcbd4da0cd85 a60c3c37d3fbd880"
"5c77f15fc6b1fdfe 614ee0a7c8fdb4c0"));
test_hash(&nettle_sha256,
LDATA("12345678901234567890123456789012"
"34567890123456789012345678901234"
"5678901234567890"),
H("f371bc4a311f2b00 9eef952dd83ca80e"
"2b60026c8e935592 d0f9c308453c813e"));
SUCCESS();
}
......@@ -18,5 +18,39 @@ test_main(void)
"53111b173b3b05d2 2fa08086e3b0f712"
"fcc7c71a557e2db9 66c3e9fa91746039"));
/* Additional test vectors, from Daniel Kahn Gillmor */
test_hash(&nettle_sha384, LDATA(""),
H("38b060a751ac9638 4cd9327eb1b1e36a"
"21fdb71114be0743 4c0cc7bf63f6e1da"
"274edebfe76f65fb d51ad2f14898b95b"));
test_hash(&nettle_sha384, LDATA("a"),
H("54a59b9f22b0b808 80d8427e548b7c23"
"abd873486e1f035d ce9cd697e8517503"
"3caa88e6d57bc35e fae0b5afd3145f31"));
test_hash(&nettle_sha384, LDATA("38"),
H("c071d202ad950b6a 04a5f15c24596a99"
"3af8b212467958d5 70a3ffd478006063"
"8e3a3d06637691d3 012bd31122071b2c"));
test_hash(&nettle_sha384, LDATA("message digest"),
H("473ed35167ec1f5d 8e550368a3db39be"
"54639f828868e945 4c239fc8b52e3c61"
"dbd0d8b4de1390c2 56dcbb5d5fd99cd5"));
test_hash(&nettle_sha384, LDATA("abcdefghijklmnopqrstuvwxyz"),
H("feb67349df3db6f5 924815d6c3dc133f"
"091809213731fe5c 7b5f4999e463479f"
"f2877f5f2936fa63 bb43784b12f3ebb4"));
test_hash(&nettle_sha384,
LDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
"ghijklmnopqrstuvwxyz0123456789"),
H("1761336e3f7cbfe5 1deb137f026f89e0"
"1a448e3b1fafa640 39c1464ee8732f11"
"a5341a6f41e0c202 294736ed64db1a84"));
test_hash(&nettle_sha384,
LDATA("12345678901234567890123456789012"
"34567890123456789012345678901234"
"5678901234567890"),
H("b12932b0627d1c06 0942f54477641556"
"55bd4da0c9afa6dd 9b9ef53129af1b8f"
"b0195996d2de9ca0 df9d821ffee67026"));
SUCCESS();
}
......@@ -20,5 +20,47 @@ test_main(void)
"501d289e4900f7e4 331b99dec4b5433a"
"c7d329eeb6dd2654 5e96e55b874be909"));
SUCCESS();
/* Additional test vectors, from Daniel Kahn Gillmor */
test_hash(&nettle_sha512, LDATA(""),
H("cf83e1357eefb8bd f1542850d66d8007"
"d620e4050b5715dc 83f4a921d36ce9ce"
"47d0d13c5d85f2b0 ff8318d2877eec2f"
"63b931bd47417a81 a538327af927da3e"));
test_hash(&nettle_sha512, LDATA("a"),
H("1f40fc92da241694 750979ee6cf582f2"
"d5d7d28e18335de0 5abc54d0560e0f53"
"02860c652bf08d56 0252aa5e74210546"
"f369fbbbce8c12cf c7957b2652fe9a75"));
test_hash(&nettle_sha512, LDATA("38"),
H("caae34a5e8103126 8bcdaf6f1d8c04d3"
"7b7f2c349afb705b 575966f63e2ebf0f"
"d910c3b05160ba08 7ab7af35d40b7c71"
"9c53cd8b947c9611 1f64105fd45cc1b2"));
test_hash(&nettle_sha512, LDATA("message digest"),
H("107dbf389d9e9f71 a3a95f6c055b9251"
"bc5268c2be16d6c1 3492ea45b0199f33"
"09e16455ab1e9611 8e8a905d5597b720"
"38ddb372a8982604 6de66687bb420e7c"));
test_hash(&nettle_sha512, LDATA("abcdefghijklmnopqrstuvwxyz"),
H("4dbff86cc2ca1bae 1e16468a05cb9881"
"c97f1753bce36190 34898faa1aabe429"
"955a1bf8ec483d74 21fe3c1646613a59"
"ed5441fb0f321389 f77f48a879c7b1f1"));
test_hash(&nettle_sha512,
LDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
"ghijklmnopqrstuvwxyz0123456789"),
H("1e07be23c26a86ea 37ea810c8ec78093"
"52515a970e9253c2 6f536cfc7a9996c4"
"5c8370583e0a78fa 4a90041d71a4ceab"
"7423f19c71b9d5a3 e01249f0bebd5894"));
test_hash(&nettle_sha512,
LDATA("12345678901234567890123456789012"
"34567890123456789012345678901234"
"5678901234567890"),
H("72ec1ef1124a45b0 47e8b7c75a932195"
"135bb61de24ec0d1 914042246e0aec3a"
"2354e093d76f3048 b456764346900cb1"
"30d2a4fd5dd16abb 5e30bcb850dee843"));
SUCCESS();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment