1 #define shachain_index_t uint8_t
3 #include <ccan/crypto/shachain/shachain.h>
4 /* Include the C files directly. */
5 #include <ccan/crypto/shachain/shachain.c>
6 #include <ccan/tap/tap.h>
10 static bool bit_set(uint64_t index, int bit)
12 return index & (1ULL << bit);
15 /* As per design.txt */
16 static bool naive_can_derive(uint64_t from, shachain_index_t to)
20 for (i = count_trailing_zeroes(from); i < 8; i++) {
21 if (bit_set(from, i) != bit_set(to, i))
31 /* This is how many tests you plan to run */
34 for (i = 0; i < 256; i++) {
35 for (j = 0; j < 256; j++) {
36 ok1(can_derive(i, j) == naive_can_derive(i, j));