aboutsummaryrefslogtreecommitdiffstats
path: root/sha1.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-23 22:36:41 +0200
committerMattias Andrée <maandree@kth.se>2024-08-23 22:40:29 +0200
commit2fd94aae29d53d9859bfc3f53777970def38e253 (patch)
treee45573486f44271d75ee22284953e5dcde303ca5 /sha1.c
parentFirst commit (diff)
downloadlibhashsum-2fd94aae29d53d9859bfc3f53777970def38e253.tar.gz
libhashsum-2fd94aae29d53d9859bfc3f53777970def38e253.tar.bz2
libhashsum-2fd94aae29d53d9859bfc3f53777970def38e253.tar.xz
Fixes + add SHA0 and SHA1 using libsha1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--sha1.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sha1.c b/sha1.c
new file mode 100644
index 0000000..3ab0776
--- /dev/null
+++ b/sha1.c
@@ -0,0 +1,27 @@
+/* See LICENSE file for copyright and license details. */
+#define TEST
+#include "common.h"
+
+
+static struct testcase testcases[] = {
+ {1, 0, "\xff", "85e53271e14006f0265921d02d4d736cdc580b0b"},
+ {1, 0, "\xe5\xe0\x99\x24", "d1dffbc8a175dd8eebe0da87b1792b6dc1018e82"},
+ {56UL, 8, "\0", "9438e360f578e12c0e0e8ed28e2c125c1cefee16"},
+ {1000UL, 0, "Q", "49f1cfe3829963158e2b2b2cb5df086cee2e3bb0"},
+ {1000UL, 0, "A", "3ae3644d6777a1f56a1defeabc74af9c4b313e49"},
+ {1005UL, 0, "\x99", "18685d56c8bf67c3cee4443e9a78f65c30752f5d"},
+ {1, 0, "abc", "a9993e364706816aba3e25717850c26c9cd0d89d"},
+ {1, 0, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "84983e441c3bd26ebaae4aa1f95129e5e54670f1"},
+ {1000000UL, 8, "\0", "bef3595266a65a2ff36b700a75e8ed95c68210b6"},
+ {0x20000000UL, 0, "A", "df3f26fce8fa7bec2c61d0506749a320ac7dc942"},
+ {0x41000000UL, 8, "\0", "320c617b0b6ee1b6f9c3271eae135f40cae22c10"},
+ {0x6000003FUL, 0, "\x84", "b20aa99b62e6a480fd93b4d24b2c19ffac649bb8"}
+};
+
+
+int
+main(void)
+{
+ TEST_MAIN("SHA1", SHA1);
+}