28 #define BOOST_TEST_MODULE sha1 29 #include <boost/test/unit_test.hpp> 37 BOOST_AUTO_TEST_SUITE ( sha1 )
40 unsigned char hash[20];
41 unsigned char reference[20] = {0xa9, 0x99, 0x3e, 0x36, 0x47,
42 0x06, 0x81, 0x6a, 0xba, 0x3e,
43 0x25, 0x71, 0x78, 0x50, 0xc2,
44 0x6c, 0x9c, 0xd0, 0xd8, 0x9d};
48 BOOST_CHECK_EQUAL_COLLECTIONS(hash, hash+20, reference, reference+20);
52 unsigned char hash[20];
53 unsigned char reference[20] = {0x84, 0x98, 0x3e, 0x44, 0x1c,
54 0x3b, 0xd2, 0x6e, 0xba, 0xae,
55 0x4a, 0xa1, 0xf9, 0x51, 0x29,
56 0xe5, 0xe5, 0x46, 0x70, 0xf1};
59 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",56,hash);
61 BOOST_CHECK_EQUAL_COLLECTIONS(hash, hash+20, reference, reference+20);
66 unsigned char hash[20];
67 unsigned char reference[20] = {0x34, 0xaa, 0x97, 0x3c, 0xd4,
68 0xc4, 0xda, 0xa4, 0xf6, 0x1e,
69 0xeb, 0x2b, 0xdb, 0xad, 0x27,
70 0x31, 0x65, 0x34, 0x01, 0x6f};
72 for (
int i = 0; i < 1000000; i++) {
78 BOOST_CHECK_EQUAL_COLLECTIONS(hash, hash+20, reference, reference+20);
81 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(sha1_test_a)
void calc(void const *src, size_t bytelength, unsigned char *hash)
Calculate a SHA1 hash.