1 #include <ccan/crypto/ripemd160/ripemd160.h>
2 /* Include the C files directly. */
3 #include <ccan/crypto/ripemd160/ripemd160.c>
4 #include <ccan/tap/tap.h>
6 static unsigned char arr[] = {
12 0x12, 0x34, 0x56, 0x78,
14 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
19 0x78, 0x56, 0x34, 0x12,
21 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12,
26 0x78, 0x56, 0x34, 0x12,
28 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12,
32 0x12, 0x34, 0x56, 0x78,
34 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0
39 struct ripemd160 h, expected;
40 struct ripemd160_ctx ctx;
42 /* This is how many tests you plan to run */
46 ripemd160_u8(&ctx, 0x12);
47 ripemd160_u16(&ctx, 0x1234);
48 ripemd160_u32(&ctx, 0x12345678);
49 ripemd160_u64(&ctx, 0x123456789abcdef0ULL);
50 ripemd160_le16(&ctx, 0x1234);
51 ripemd160_le32(&ctx, 0x12345678);
52 ripemd160_le64(&ctx, 0x123456789abcdef0ULL);
53 ripemd160_be16(&ctx, 0x1234);
54 ripemd160_be32(&ctx, 0x12345678);
55 ripemd160_be64(&ctx, 0x123456789abcdef0ULL);
56 ripemd160_done(&ctx, &h);
58 ripemd160(&expected, arr, sizeof(arr));
59 ok1(memcmp(&h, &expected, sizeof(h)) == 0);
61 /* This exits depending on whether all tests passed */