Tizen 2.0 Release
[external/nettle.git] / testsuite / sha384-test.c
1 #include "testutils.h"
2 #include "sha.h"
3
4 int
5 test_main(void)
6 {
7   test_hash(&nettle_sha384, 3, "abc",
8             H("cb00753f45a35e8b b5a03d699ac65007"
9               "272c32ab0eded163 1a8b605a43ff5bed"
10               "8086072ba1e7cc23 58baeca134c825a7"));
11   
12   test_hash(&nettle_sha384, 112,
13             "abcdefghbcdefghicdefghijdefg"
14             "hijkefghijklfghijklmghijklmn"
15             "hijklmnoijklmnopjklmnopqklmn"
16             "opqrlmnopqrsmnopqrstnopqrstu",
17             H("09330c33f71147e8 3d192fc782cd1b47"
18               "53111b173b3b05d2 2fa08086e3b0f712"
19               "fcc7c71a557e2db9 66c3e9fa91746039"));
20
21   /* Additional test vectors, from Daniel Kahn Gillmor */
22   test_hash(&nettle_sha384, LDATA(""),
23             H("38b060a751ac9638 4cd9327eb1b1e36a"
24               "21fdb71114be0743 4c0cc7bf63f6e1da"
25               "274edebfe76f65fb d51ad2f14898b95b"));
26   test_hash(&nettle_sha384, LDATA("a"),
27             H("54a59b9f22b0b808 80d8427e548b7c23"
28               "abd873486e1f035d ce9cd697e8517503"
29               "3caa88e6d57bc35e fae0b5afd3145f31"));
30   test_hash(&nettle_sha384, LDATA("38"),
31             H("c071d202ad950b6a 04a5f15c24596a99"
32               "3af8b212467958d5 70a3ffd478006063"
33               "8e3a3d06637691d3 012bd31122071b2c"));
34   test_hash(&nettle_sha384, LDATA("message digest"),
35             H("473ed35167ec1f5d 8e550368a3db39be"
36               "54639f828868e945 4c239fc8b52e3c61"
37               "dbd0d8b4de1390c2 56dcbb5d5fd99cd5"));
38   test_hash(&nettle_sha384, LDATA("abcdefghijklmnopqrstuvwxyz"),
39             H("feb67349df3db6f5 924815d6c3dc133f"
40               "091809213731fe5c 7b5f4999e463479f"
41               "f2877f5f2936fa63 bb43784b12f3ebb4"));
42   test_hash(&nettle_sha384,
43             LDATA("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
44                   "ghijklmnopqrstuvwxyz0123456789"),
45             H("1761336e3f7cbfe5 1deb137f026f89e0"
46               "1a448e3b1fafa640 39c1464ee8732f11"
47               "a5341a6f41e0c202 294736ed64db1a84"));
48   test_hash(&nettle_sha384,
49             LDATA("12345678901234567890123456789012"
50                   "34567890123456789012345678901234"
51                   "5678901234567890"),
52             H("b12932b0627d1c06 0942f54477641556"
53               "55bd4da0c9afa6dd 9b9ef53129af1b8f"
54               "b0195996d2de9ca0 df9d821ffee67026"));
55
56   SUCCESS();
57 }