~ubuntu-branches/ubuntu/vivid/nettle/vivid-proposed

« back to all changes in this revision

Viewing changes to testsuite/sha384-test.c

  • Committer: Package Import Robot
  • Author(s): Magnus Holmgren
  • Date: 2013-05-04 19:50:28 UTC
  • mfrom: (1.4.6) (3.1.11 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20130504195028-fp6c9fw1tsm5scwa
Tags: 2.7-1
* New upstream release (Closes: #706081).
* Include watch file improvements from Bart Martens <bartm@debian.org>
  via the QA system.

Show diffs side-by-side

added added

removed removed

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