summaryrefslogtreecommitdiff
path: root/nettle
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2004-12-26 16:23:17 +0000
committerSimon Josefsson <simon@josefsson.org>2004-12-26 16:23:17 +0000
commit4a80c51da87a2f5167d85e3d7ae187a4545bd26b (patch)
tree8824474e7178a3ded0d29651dc6f850a3c0acbd3 /nettle
parent56b4a98775c689bdfbe9c7c2c7037781c3394ff9 (diff)
downloadgnutls-4a80c51da87a2f5167d85e3d7ae187a4545bd26b.tar.gz
Add MD2.
Diffstat (limited to 'nettle')
-rw-r--r--nettle/Makefile.am1
-rw-r--r--nettle/tests/md2-test.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/nettle/Makefile.am b/nettle/Makefile.am
index 3da6a3dbb1..766766cbc6 100644
--- a/nettle/Makefile.am
+++ b/nettle/Makefile.am
@@ -39,6 +39,7 @@ libnettle_la_SOURCES = aes.c aes.h aes-internal.h \
hmac.c hmac.h hmac-md5.c hmac-sha1.c \
knuth-lfib.h knuth-lfib.c \
md5.c md5.h md5-meta.c \
+ md2.c md2.h md2-meta.c \
sha.h sha1.c sha1-compress.c sha1-meta.c \
nettle-meta.h \
nettle-internal.c nettle-internal.h \
diff --git a/nettle/tests/md2-test.c b/nettle/tests/md2-test.c
new file mode 100644
index 0000000000..8ab45c170e
--- /dev/null
+++ b/nettle/tests/md2-test.c
@@ -0,0 +1,27 @@
+#include "testutils.h"
+#include "md2.h"
+
+int
+test_main(void)
+{
+ /* Testcases from RFC 1319 */
+ test_hash(&nettle_md2, 0, "",
+ H("8350e5a3e24c153df2275c9f80692773"));
+ test_hash(&nettle_md2, LDATA("a"),
+ H("32ec01ec4a6dac72c0ab96fb34c0b5d1"));
+ test_hash(&nettle_md2, LDATA("abc"),
+ H("da853b0d3f88d99b30283a69e6ded6bb"));
+ test_hash(&nettle_md2, LDATA("message digest"),
+ H("ab4f496bfb2a530b219ff33031fe06b0"));
+ test_hash(&nettle_md2, LDATA("abcdefghijklmnopqrstuvwxyz"),
+ H("4e8ddff3650292ab5a4108c3aa47940b"));
+ test_hash(&nettle_md2,
+ LDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"),
+ H("da33def2a42df13975352846c30338cd"));
+ test_hash(&nettle_md2, LDATA("1234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890"),
+ H("d5976f79d83d3a0dc9806c3c66f3efd8"));
+
+ SUCCESS();
+}