summaryrefslogtreecommitdiff
path: root/testsuite/md5-test.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2004-08-23 21:50:00 +0200
committerNiels Möller <nisse@lysator.liu.se>2004-08-23 21:50:00 +0200
commit2fa62fdd60d2a16d887d17802cb0ad715115c10c (patch)
tree34cbf545bf9708fa4139b1172829dc96fca726a7 /testsuite/md5-test.c
parent04fc6891b059b88255dc7e78dcee85a1cd1c726c (diff)
downloadnettle-2fa62fdd60d2a16d887d17802cb0ad715115c10c.tar.gz
(test_main): Added second collision.
Rev: src/nettle/testsuite/md5-test.c:1.5
Diffstat (limited to 'testsuite/md5-test.c')
-rw-r--r--testsuite/md5-test.c68
1 files changed, 50 insertions, 18 deletions
diff --git a/testsuite/md5-test.c b/testsuite/md5-test.c
index d1efa5b4..949ea941 100644
--- a/testsuite/md5-test.c
+++ b/testsuite/md5-test.c
@@ -33,30 +33,62 @@ test_main(void)
/* Collisions, reported by Xiaoyun Wang1, Dengguo Feng2, Xuejia
Lai3, Hongbo Yu1, http://eprint.iacr.org/2004/199. */
+#define M0 \
+ /* vv */ \
+ "d131dd02 c5e6eec4 693d9a06 98aff95c 2fcab5 87 12467eab 4004583e b8fb7f89" \
+ "55ad3406 09f4b302 83e48883 25 71 415a 085125e8 f7cdc99f d91dbd f2 80373c5b" \
+ /* ^^ ^^ */
+
+#define M1 \
+ /* vv */ \
+ "d131dd02 c5e6eec4 693d9a06 98aff95c 2fcab5 07 12467eab 4004583e b8fb7f89" \
+ "55ad3406 09f4b302 83e48883 25 f1 415a 085125e8 f7cdc99f d91dbd 72 80373c5b" \
+ /* ^^ ^^ */
+
+#define N0 \
+ /* vv */ \
+ "960b1dd1 dc417b9c e4d897f4 5a6555d5 35739a c7 f0ebfd0c 3029f166 d109b18f" \
+ "75277f79 30d55ceb 22e8adba 79 cc 155c ed74cbdd 5fc5d36d b19b0a d8 35cca7e3" \
+ /* ^^ ^^ */
+
+#define N1 \
+ /* vv */ \
+ "960b1dd1 dc417b9c e4d897f4 5a6555d5 35739a 47 f0ebfd0c 3029f166 d109b18f" \
+ "75277f79 30d55ceb 22e8adba 79 4c 155c ed74cbdd 5fc5d36d b19b0a 58 35cca7e3" \
+ /* ^^ ^^ */
+
/* Note: The checksum in the paper, 1f160396 efc71ff4 bcff659f
bf9d0fa3, is incorrect. */
+#define H0 "a4c0d35c 95a63a80 5915367d cfe6b751"
+
+#define N2 \
+ /* vv */ \
+ "d8823e31 56348f5b ae6dacd4 36c919c6 dd53e2 b4 87da03fd 02396306 d248cda0" \
+ "e99f3342 0f577ee8 ce54b670 80 a8 0d1e c69821bc b6a88393 96f965 2b 6ff72a70" \
+ /* ^^ ^^ */
+
+#define N3 \
+ /* vv */ \
+ "d8823e31 56348f5b ae6dacd4 36c919c6 dd53e2 34 87da03fd 02396306 d248cda0" \
+ "e99f3342 0f577ee8 ce54b670 80 28 0d1e c69821bc b6a88393 96f965 ab 6ff72a70" \
+ /* ^^ ^^ */
+
+ /* Note: Also different from the checksum in the paper */
+
+#define H1 "79054025 255fb1a2 6e4bc422 aef54eb4"
+
+ test_hash(&nettle_md5,
+ HL(M0 N0), H(H0));
+
+ test_hash(&nettle_md5,
+ HL(M1 N1), H(H0));
+
test_hash(&nettle_md5,
- HL("d131dd02 c5e6eec4 693d9a06 98aff95c 2fcab5 87 12467eab 4004583e b8fb7f89"
- /* ^^ */
- "55ad3406 09f4b302 83e48883 25 71 415a 085125e8 f7cdc99f d91dbd f2 80373c5b"
- /* ^^ ^^ */
- "960b1dd1 dc417b9c e4d897f4 5a6555d5 35739a c7 f0ebfd0c 3029f166 d109b18f"
- /* ^^ */
- "75277f79 30d55ceb 22e8adba 79cc155c ed74cbdd 5fc5d36d b19b0ad8 35cca7e3"),
- /* ^^ ^^ */
- H("a4c0d35c 95a63a80 5915367d cfe6b751"));
+ HL(M0 N2), H(H1));
test_hash(&nettle_md5,
- HL("d131dd02 c5e6eec4 693d9a06 98aff95c 2fcab5 07 12467eab 4004583e b8fb7f89"
- /* ^^ */
- "55ad3406 09f4b302 83e48883 25 f1 415a 085125e8 f7cdc99f d91dbd 72 80373c5b"
- /* ^^ ^^ */
- "960b1dd1 dc417b9c e4d897f4 5a6555d5 35739a 47 f0ebfd0c 3029f166 d109b18f"
- /* ^^ */
- "75277f79 30d55ceb 22e8adba 79 4c 155c ed74cbdd 5fc5d36d b19b0a 58 35cca7e3"),
- /* ^^ ^^ */
- H("a4c0d35c 95a63a80 5915367d cfe6b751"));
+ HL(M1 N3), H(H1));
SUCCESS();
}