1 /*******************************/
2 /* GENERATED FILE, DO NOT EDIT */
3 /*******************************/
7 /*******************************/
8 /* GENERATED FILE, DO NOT EDIT */
9 /*******************************/
13 #include "portable.h" /* hexa_str */
15 static char* mycmp(const char *p1, const char *p2,size_t n) {
20 return bprintf("Differs on %d -- Ox%x",i,p1[i]);
23 return xbt_strdup("");
26 static void test_sha(const char *clear,const char *hashed) {
30 xbt_test_add1("==== Test with '%s'",clear);
31 xbt_test_assert3(!memcmp(hash, hashed, 40), "Wrong sha: %40s!=%40s (%s)",
32 hash,hashed,mycmp(hash,hashed,40));
36 XBT_LOG_NEW_DEFAULT_CATEGORY(hash,"Tests of various hash functions ");
39 XBT_TEST_UNIT("sha",test_crypto_sha,"Test of the sha algorithm") {
40 /* Empty string as test vector */
41 test_sha("", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
43 /* Some pangram as test vector */
44 test_sha("The quick brown fox jumps over the lazy dog", "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12");
45 test_sha("Woven silk pyjamas exchanged for blue quartz","da3aff337c810c6470db4dbf0f205c8afc31c442");
46 test_sha("Pack my box with five dozen liquor jugs", "373ba8be29d4d95708bf7cd43038f4e409dcb439");
49 /*******************************/
50 /* GENERATED FILE, DO NOT EDIT */
51 /*******************************/