]> git.ozlabs.org Git - ccan/blob - ccan/crypto/sha256/test/run-lotsa-data.c
shachain: allow overriding of number of bits, add cmdline tool.
[ccan] / ccan / crypto / sha256 / test / run-lotsa-data.c
1 #include <ccan/crypto/sha256/sha256.h>
2 /* Include the C files directly. */
3 #include <ccan/crypto/sha256/sha256.c>
4 #include <ccan/tap/tap.h>
5
6 int main(void)
7 {
8         struct sha256 h, expected;
9         static const char zeroes[1000];
10         size_t i;
11
12         plan_tests(63);
13
14         /* Test different alignments. */
15         sha256(&expected, zeroes, sizeof(zeroes) - 64);
16         for (i = 1; i < 64; i++) {
17                 sha256(&h, zeroes + i, sizeof(zeroes) - 64);
18                 ok1(memcmp(&h, &expected, sizeof(h)) == 0);
19         }
20
21         /* This exits depending on whether all tests passed */
22         return exit_status();
23 }