diff options
Diffstat (limited to '')
-rw-r--r-- | md5.c | 129 |
1 files changed, 129 insertions, 0 deletions
@@ -0,0 +1,129 @@ +/* See LICENSE file for copyright and license details. */ +#ifdef SUPPORT_MD5 +# define TEST +# include "common.h" + + +static struct testcase testcases[] = { + {1, 0, "", "d41d8cd98f00b204e9800998ecf8427e"}, + {1, 0, "a\n", "60b725f10c9c85c70d97880dfe8191b3"}, + {1, 0, "a", "0cc175b9c0f1b6a831c399e269772661"}, + {1, 0, "\n", "68b329da9893e34099c7d8ad5cb9c940"}, + {1, 0, "\n\n", "e1c06d85ae7b8b032bef47e42e4c08f9"}, + {1, 40, "\0\0\0\0\n", "220837fefd71ea604ab9f99017c9cb0e"}, + {1, 0, "abc", "900150983cd24fb0d6963f7d28e17f72"}, + {1, 0, "The quick brown fox jumps over the lazy dog", + "9e107d9d372bb6826bd81d3542a419d6"}, + {1, 0, "The quick brown fox jumps over the lazy dog.", + "e4d909c290d0fb1ca068ffaddf22cbd0"}, + {1, 0, "a\nb\nc\nd\ne\n", + "1065e32f2cfab7352c6d3211f5447069"}, + {1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "d174ab98d277d9f5a5611c2c9f419d9f"}, + {1, 0, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a"}, + {1, 0, "abcdefghijklmnopqrstuvwxyz", + "c3fcd3d76192e4007dfb496cca67e13b"}, + {1UL, 0, "x", "9dd4e461268c8034f5c8564e155c67a6"}, + {2UL, 0, "x", "9336ebf25087d91c818ee6e9ec29f8c1"}, + {3UL, 0, "x", "f561aaf6ef0bf14d4208bb46a4ccb3ad"}, + {4UL, 0, "x", "ea416ed0759d46a8de58f63a59077499"}, + {5UL, 0, "x", "fb0e22c79ac75679e9881e6ba183b354"}, + {6UL, 0, "x", "dad3a37aa9d50688b5157698acfd7aee"}, + {7UL, 0, "x", "04adb4e2f055c978c9bb101ee1bc5cd4"}, + {8UL, 0, "x", "0b0cfc07fca81c956ab9181d8576f4a8"}, + {9UL, 0, "x", "aba369f7d2b28a9098a0a26feb7dc965"}, + {10UL, 0, "x", "336311a016184326ddbdd61edd4eeb52"}, + {11UL, 0, "x", "dcb740b2c2836cb11f707d63e6ac664f"}, + {12UL, 0, "x", "f94c84fac5cb091c60bb143cb957d229"}, + {13UL, 0, "x", "df7c0a3fa59809752be392c52c4a0559"}, + {14UL, 0, "x", "4e619f5b28df4a9744963e6700abe7ca"}, + {15UL, 0, "x", "de59bd9061c93855e3fdd416e26f27a6"}, + {16UL, 0, "x", "45ed9cc2f92b77cd8b2f5bd59ff635f8"}, + {17UL, 0, "x", "3ef82839679f05ef260e3ac982de93cd"}, + {18UL, 0, "x", "40e6267e5814c629b8e292735a77e2a9"}, + {19UL, 0, "x", "079080d02c875b5a30be6e1e59ce6aa3"}, + {20UL, 0, "x", "baf1da0e2b9065ab5edd36ca00ed1826"}, + {28UL, 0, "x", "cd25b7f1c589ff14b9e9c0c5c2555ff2"}, + {29UL, 0, "x", "0d046efba26ac1a3f561246081c086e7"}, + {30UL, 0, "x", "4495c1948d806f6dd8cbd8e15f7e254a"}, + {31UL, 0, "x", "48e95c91781dcf2c5eb90da6e8dcc14d"}, + {32UL, 0, "x", "dc8fe1d6497ebd23f5975d8d2a1c5e81"}, + {33UL, 0, "x", "b7b82191a246d3563ed060e298add91d"}, + {34UL, 0, "x", "07e932fcd783c8deab1d20a49ed80c39"}, + {35UL, 0, "x", "d77c54ec53a4ef5d5f81ed5685560e31"}, + {36UL, 0, "x", "7c3f98f113332d38d08b5e9014792ba0"}, + {60UL, 0, "x", "1198000c11968f9368e02d6da57ec147"}, + {61UL, 0, "x", "ee8c65d71323cc65e6e8535663ea817c"}, + {62UL, 0, "x", "31f6affeacbf0a8196f061a4e49a8a15"}, + {63UL, 0, "x", "7dc2ca208106a2f703567bdff99d8981"}, + {64UL, 0, "x", "c1bb4f81d892b2d57947682aeb252456"}, + {65UL, 0, "x", "1bc932052302d074bdec39795fe00cf6"}, + {66UL, 0, "x", "3c8d35046511f6b1b05e721d4f60256e"}, + {67UL, 0, "x", "4bbca3f0abeaab4b7342a77e75f31d58"}, + {68UL, 0, "x", "ffec2ae499ea42e2a8fa19b167e873dc"}, + {124UL, 0, "x", "a35da70d31690b66cabdd4288671c263"}, + {125UL, 0, "x", "09caa6eb477f42e8e19f5f3b4b42d849"}, + {126UL, 0, "x", "8dd415f6a3a27df0899c8c6b54ea27ed"}, + {127UL, 0, "x", "a0b28c1da68705c2ff883fe279b72753"}, + {128UL, 0, "x", "d69cb61a6ee87200676eb0d4b90edbcb"}, + {129UL, 0, "x", "3926841d393c00c3f36260e5ace10dc1"}, + {130UL, 0, "x", "cfc92f41305ca00c9f9584bf67ae1b54"}, + {131UL, 0, "x", "6cc46654feb888930c09d25f5c4d45a8"}, + {132UL, 0, "x", "326c994f14a44790edbe0aa08dce10c5"}, + {252UL, 0, "x", "96897c58b701383553034d7027eef698"}, + {253UL, 0, "x", "1a244ae9fefe18985dbeec401592f821"}, + {254UL, 0, "x", "1bfbf8d01c1d8d19664a9834edf6a182"}, + {255UL, 0, "x", "cb3ead3ffb3d928128c57a88ddc023c9"}, + {256UL, 0, "x", "c7a139a2b8e92164276f778917ba10b9"}, + {257UL, 0, "x", "d36a37136d406826a19f8d222217fcf2"}, + {258UL, 0, "x", "b53fb5e097ce58fa2e4ca1ddd9cb4c17"}, + {259UL, 0, "x", "212075aa9ea2f4dfcd787fd722c6ca36"}, + {260UL, 0, "x", "a9c279980354afb717ecb974915f5735"}, + {508UL, 0, "x", "4dc1fad83b9ed2d53e6ee24ec6e3cd77"}, + {509UL, 0, "x", "d5e9a6bb15c49dd852836ad1e3b7cc55"}, + {510UL, 0, "x", "68c0b8dbb509c84b314782acb7fa8f52"}, + {511UL, 0, "x", "dc1c50246bf0c9d112ae426500a49ccd"}, + {512UL, 0, "x", "9147bc1f0f20e8ae1932e616b51240fb"}, + {513UL, 0, "x", "d70999aa02d6479b04bc87c1c60a5073"}, + {514UL, 0, "x", "51010e21c8ba2f8f37e312a2fa34795c"}, + {515UL, 0, "x", "7f5d20b68c0da40ce24d0124ad5ad67f"}, + {516UL, 0, "x", "2b6c8b791a19fd9de9dc5aba0ed7bf6d"}, + {1020UL, 0, "x", "b73908fc7f1175d53183e646f4298478"}, + {1021UL, 0, "x", "e52374c56cbf8a50e133ef7f8c9aeb50"}, + {1022UL, 0, "x", "5e4d064e9476082eb78ba62a31c0935c"}, + {1023UL, 0, "x", "7c944a22b4db95dd90b61331cafe605c"}, + {1024UL, 0, "x", "7265f4d211b56873a381d321f586e4a9"}, + {1025UL, 0, "x", "41b2b8ce59ecc0c64c9c7ecaae3002c3"}, + {1026UL, 0, "x", "aabf55b958bc5b71749ee9c64523933f"}, + {1027UL, 0, "x", "f8f06f8e36e9435183db627789cdd691"}, + {1028UL, 0, "x", "8f1c68e076235ba5f52bf16f41b12194"}, + {2044UL, 0, "x", "43c5028529ab5f64903b1e1459948a7f"}, + {2045UL, 0, "x", "ea156212359f7894058fa2cc4193b0d7"}, + {2046UL, 0, "x", "a77d0af5147801eceda2e059a6ee8eb4"}, + {2047UL, 0, "x", "5aa00f0f1280c998648ecae491964f66"}, + {2048UL, 0, "x", "cfb767f225d58469c5de3632a8803958"}, + {2049UL, 0, "x", "01ee208262ef50b8ea672d0865ad58fa"}, + {2050UL, 0, "x", "da23b925b41f6160146ade5dc7f65281"}, + {2051UL, 0, "x", "2583da14d43398956e19e24a6f591748"}, + {2052UL, 0, "x", "2388049a9674713a2e82cd59d2cc9241"}, + {0, 1, "\xff", "7e663710ae2348bf0deaca2c79311eae"}, + {0, 1, "\x7f", "7e663710ae2348bf0deaca2c79311eae"}, + {0, 1, "\x01", "7e663710ae2348bf0deaca2c79311eae"}, + {0, 1, "\xfe", "1da635b1430f171c657206fd69fee0e8"}, + {0, 1, "\x7e", "1da635b1430f171c657206fd69fee0e8"}, + {0, 1, "\x00", "1da635b1430f171c657206fd69fee0e8"} +}; + + +#else +# define TEST_UNSUPPORTED +# include "common.h" +#endif + + +int +main(void) +{ + TEST_MAIN("MD5", MD5); +} |