| 7 | |
| 8 | Y_UNIT_TEST_SUITE(TMD5Test) { |
| 9 | Y_UNIT_TEST(TestMD5) { |
| 10 | // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum |
| 11 | constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; |
| 12 | |
| 13 | MD5 r; |
| 14 | r.Update((const unsigned char*)b, 15); |
| 15 | r.Update((const unsigned char*)b + 15, strlen(b) - 15); |
| 16 | |
| 17 | char rs[33]; |
| 18 | TString s(r.End(rs)); |
| 19 | s.to_lower(); |
| 20 | |
| 21 | UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); |
| 22 | |
| 23 | TString result = r.Calc(TStringBuf(b)); |
| 24 | result.to_lower(); |
| 25 | UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); |
| 26 | } |
| 27 | |
| 28 | Y_UNIT_TEST(TestFile) { |
| 29 | TString s = NUnitTest::RandomString(1000000, 1); |