aboutsummaryrefslogtreecommitdiffstats
path: root/sha_512.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha_512.c')
-rw-r--r--sha_512.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/sha_512.c b/sha_512.c
new file mode 100644
index 0000000..c370750
--- /dev/null
+++ b/sha_512.c
@@ -0,0 +1,84 @@
+/* See LICENSE file for copyright and license details. */
+#ifdef SUPPORT_SHA2
+# define TEST
+# include "common.h"
+
+
+static struct testcase testcases[] = {
+ {1, 0, "",
+ "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce"
+ "47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"},
+ {111UL, 8, "\0",
+ "77ddd3a542e530fd047b8977c657ba6ce72f1492e360b2b2212cd264e75ec038"
+ "82e4ff0525517ab4207d14c70c2259ba88d4d335ee0e7e20543d22102ab1788c"},
+ {112UL, 8, "\0",
+ "2be2e788c8a8adeaa9c89a7f78904cacea6e39297d75e0573a73c756234534d6"
+ "627ab4156b48a6657b29ab8beb73334040ad39ead81446bb09c70704ec707952"},
+ {113UL, 8, "\0",
+ "0e67910bcf0f9ccde5464c63b9c850a12a759227d16b040d98986d54253f9f34"
+ "322318e56b8feb86c5fb2270ed87f31252f7f68493ee759743909bd75e4bb544"},
+ {122UL, 8, "\0",
+ "4f3f095d015be4a7a7cc0b8c04da4aa09e74351e3a97651f744c23716ebd9b3e"
+ "822e5077a01baa5cc0ed45b9249e88ab343d4333539df21ed229da6f4a514e0f"},
+ {1000UL, 8, "\0",
+ "ca3dff61bb23477aa6087b27508264a6f9126ee3a004f53cb8db942ed345f2f2"
+ "d229b4b59c859220a1cf1913f34248e3803bab650e849a3d9a709edc09ae4a76"},
+ {1000UL, 0, "A",
+ "329c52ac62d1fe731151f2b895a00475445ef74f50b979c6f7bb7cae349328c1"
+ "d4cb4f7261a0ab43f936a24b000651d4a824fcdd577f211aef8f806b16afe8af"},
+ {1005UL, 0, "U",
+ "59f5e54fe299c6a8764c6b199e44924a37f59e2b56c3ebad939b7289210dc8e4"
+ "c21b9720165b0f4d4374c90f1bf4fb4a5ace17a1161798015052893a48c3d161"},
+ {1000000UL, 8, "\0",
+ "ce044bc9fd43269d5bbc946cbebc3bb711341115cc4abdf2edbc3ff2c57ad4b1"
+ "5deb699bda257fea5aef9c6e55fcf4cf9dc25a8c3ce25f2efe90908379bff7ed"},
+# ifdef MASSIVE_TESTS
+ {0x20000000UL, 0, "Z",
+ "da172279f3ebbda95f6b6e1e5f0ebec682c25d3d93561a1624c2fa9009d64c7e"
+ "9923f3b46bcaf11d39a531f43297992ba4155c7e827bd0f1e194ae7ed6de4cac"},
+ {0x41000000UL, 8, "\0",
+ "14b1be901cb43549b4d831e61e5f9df1c791c85b50e85f9d6bc64135804ad43c"
+ "e8402750edbe4e5c0fc170b99cf78b9f4ecb9c7e02a157911d1bd1832d76784f"},
+ {0x6000003EUL, 0, "B",
+ "fd05e13eb771f05190bd97d62647157ea8f1f6949a52bb6daaedbad5f578ec59"
+ "b1b8d6c4a7ecb2feca6892b4dc138771670a0f3bd577eea326aed40ab7dd58b1"},
+# endif
+ {1, 0, "abc",
+ "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a"
+ "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"},
+ {1, 0, "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
+ "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
+ "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018"
+ "501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"},
+ {0, 1, "\xff",
+ "5f72ee8494a425ba13fc8c48ac0a05cbaae7e932e471e948cb524333745aa432"
+ "c1851c0c43682b0e67d64626f8f45cf165f6b538a94c63be98224e969e75d7ed"},
+ {0, 1, "\x7f",
+ "5f72ee8494a425ba13fc8c48ac0a05cbaae7e932e471e948cb524333745aa432"
+ "c1851c0c43682b0e67d64626f8f45cf165f6b538a94c63be98224e969e75d7ed"},
+ {0, 1, "\x01",
+ "5f72ee8494a425ba13fc8c48ac0a05cbaae7e932e471e948cb524333745aa432"
+ "c1851c0c43682b0e67d64626f8f45cf165f6b538a94c63be98224e969e75d7ed"},
+ {0, 1, "\xfe",
+ "b4594eb12959fc2e6979b6783554299cc0369f44083a8b0955baefd8830cda22"
+ "894b0b46c0ed49490e391ad99af856cc1bd96f238c7f2a17cf37aeb7e793395a"},
+ {0, 1, "\x7e",
+ "b4594eb12959fc2e6979b6783554299cc0369f44083a8b0955baefd8830cda22"
+ "894b0b46c0ed49490e391ad99af856cc1bd96f238c7f2a17cf37aeb7e793395a"},
+ {0, 1, "\x00",
+ "b4594eb12959fc2e6979b6783554299cc0369f44083a8b0955baefd8830cda22"
+ "894b0b46c0ed49490e391ad99af856cc1bd96f238c7f2a17cf37aeb7e793395a"}
+};
+
+
+#else
+# define TEST_UNSUPPORTED
+# include "common.h"
+#endif
+
+
+int
+main(void)
+{
+ TEST_MAIN("SHA-512", SHA_512);
+}