From b35cea4b8d82a28994351f3b550e8191ee1d94bf Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Aug 2024 23:28:25 +0200 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- sha1.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sha1.c (limited to 'sha1.c') diff --git a/sha1.c b/sha1.c new file mode 100644 index 0000000..d7669df --- /dev/null +++ b/sha1.c @@ -0,0 +1,50 @@ +/* See LICENSE file for copyright and license details. */ +#ifdef SUPPORT_SHA1 +# define TEST +# include "common.h" + + +static struct testcase testcases[] = { + {1, 0, "", "da39a3ee5e6b4b0d3255bfef95601890afd80709"}, + {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"}, +# ifdef MASSIVE_TESTS + {0x20000000UL, 0, "A", "df3f26fce8fa7bec2c61d0506749a320ac7dc942"}, + {0x41000000UL, 8, "\0", "320c617b0b6ee1b6f9c3271eae135f40cae22c10"}, + {0x6000003FUL, 0, "\x84", "b20aa99b62e6a480fd93b4d24b2c19ffac649bb8"}, +# endif + {1000000UL, 8, "\0", "bef3595266a65a2ff36b700a75e8ed95c68210b6"}, + {0, 1, "\x00", "bb6b3e18f0115b57925241676f5b1ae88747b08a"}, + {0, 2, "\x01", "ec6b39952e1a3ec3ab3507185cf756181c84bbe2"}, + {0, 3, "\x04", "a37596ec13a0d2f9e6c0b8b96f9112823aa6d961"}, + {0, 4, "\x0d", "ba582f5967911beb91599684c2eb2baeefb78da7"}, + {0, 5, "\x09", "3320540d1c28b96ddd03eee1b186a8f2ae883fbe"}, + {0, 6, "\x08", "b372bd120957ebc3392cd060e131699d1fee6059"}, + {0, 7, "\x22", "04f31807151181ad0db278a1660526b0aeef64c2"}, + {0, 1, "\xff", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"}, + {0, 1, "\x7f", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"}, + {0, 1, "\x01", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"}, + {0, 1, "\xfe", "bb6b3e18f0115b57925241676f5b1ae88747b08a"}, + {0, 1, "\x7e", "bb6b3e18f0115b57925241676f5b1ae88747b08a"}, + {0, 1, "\x00", "bb6b3e18f0115b57925241676f5b1ae88747b08a"} +}; + + +#else +# define TEST_UNSUPPORTED +# include "common.h" +#endif + + +int +main(void) +{ + TEST_MAIN("SHA1", SHA1); +} -- cgit v1.2.3-70-g09d2