1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* See LICENSE file for copyright and license details. */
#ifdef SUPPORT_SHA2
# define TEST
# include "../common.h"
static struct testcase testcases[] = {
{1, 0, "", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
{1, 0, "\xbd", "68325720aabd7c82f30f554b313d0570c95accbb7dc4b5aae11204c08ffe732b"},
{1, 0, "\xc9\x8c\x8eU", "7abc22c0ae5af26ce93dbb94433a0e0b2e119d014f8e7f65bd56c61ccccd9504"},
{55UL, 8, "\0", "02779466cdec163811d078815c633f21901413081449002f24aa3e80f0b88ef7"},
{56UL, 8, "\0", "d4817aa5497628e7c77e6b606107042bbba3130888c5f47a375e6179be789fbb"},
{57UL, 8, "\0", "65a16cb7861335d5ace3c60718b5052e44660726da4cd13bb745381b235a1785"},
{64UL, 8, "\0", "f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b"},
{1000UL, 8, "\0", "541b3e9daa09b20bf85fa273e5cbd3e80185aa4ec298e765db87742b70138a53"},
{1000UL, 0, "A", "c2e686823489ced2017f6059b8b239318b6364f6dcd835d0a519105a1eadd6e4"},
{1005UL, 0, "U", "f4d62ddec0f3dd90ea1380fa16a5ff8dc4c54b21740650f24afc4120903552b0"},
{1000000UL, 8, "\0", "d29751f2649b32ff572b5e0a9f541ea660a50f94ff0beedfb0b692b924cc8025"},
#ifdef MASSIVE_TESTS
{0x20000000UL, 0, "Z", "15a1868c12cc53951e182344277447cd0979536badcc512ad24c67e9b2d4f3dd"},
{0x41000000UL, 8, "\0", "461c19a93bd4344f9215f5ec64357090342bc66b15a148317d276e31cbc20b53"},
{0x6000003EUL, 0, "B", "c23ce8a7895f4b21ec0daf37920ac0a262a220045a03eb2dfed48ef9b05aabea"},
#endif
{1, 0, "abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"},
{1, 0, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"},
{0, 1, "\xff", "b9debf7d52f36e6468a54817c1fa071166c3a63d384850e1575b42f702dc5aa1"},
{0, 1, "\x7f", "b9debf7d52f36e6468a54817c1fa071166c3a63d384850e1575b42f702dc5aa1"},
{0, 1, "\x01", "b9debf7d52f36e6468a54817c1fa071166c3a63d384850e1575b42f702dc5aa1"},
{0, 1, "\xfe", "bd4f9e98beb68c6ead3243b1b4c7fed75fa4feaab1f84795cbd8a98676a2a375"},
{0, 1, "\x7e", "bd4f9e98beb68c6ead3243b1b4c7fed75fa4feaab1f84795cbd8a98676a2a375"},
{0, 1, "\x00", "bd4f9e98beb68c6ead3243b1b4c7fed75fa4feaab1f84795cbd8a98676a2a375"}
};
#else
# define TEST_UNSUPPORTED
# include "../common.h"
#endif
int
main(void)
{
TEST_MAIN("SHA-256", SHA_256);
}
|