diff options
author | mvel <mvel@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
commit | bd30392c4cc92487950adc375c07adf52da1d592 (patch) | |
tree | e8d1a3f19b7fc890bcef6e4cc5de41f1d88c9ac3 /library/cpp/digest/md5/md5_ut.cpp | |
parent | 5d50718e66d9c037dc587a0211110b7d25a66185 (diff) | |
download | ydb-bd30392c4cc92487950adc375c07adf52da1d592.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/md5/md5_ut.cpp')
-rw-r--r-- | library/cpp/digest/md5/md5_ut.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9..d92efc9975 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -7,35 +7,35 @@ Y_UNIT_TEST_SUITE(TMD5Test) { Y_UNIT_TEST(TestMD5) { - // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum + // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; - MD5 r; - r.Update((const unsigned char*)b, 15); - r.Update((const unsigned char*)b + 15, strlen(b) - 15); + MD5 r; + r.Update((const unsigned char*)b, 15); + r.Update((const unsigned char*)b + 15, strlen(b) - 15); - char rs[33]; + char rs[33]; TString s(r.End(rs)); - s.to_lower(); + s.to_lower(); UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); TString result = r.Calc(TStringBuf(b)); - result.to_lower(); + result.to_lower(); UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); - } + } Y_UNIT_TEST(TestFile) { TString s = NUnitTest::RandomString(1000000, 1); const TString tmpFile = "tmp"; - { + { TFixedBufferFileOutput fo(tmpFile); fo.Write(s.data(), s.size()); - } + } - char fileBuf[100]; - char memBuf[100]; + char fileBuf[100]; + char memBuf[100]; TString fileHash = MD5::File(tmpFile.data(), fileBuf); TString memoryHash = MD5::Data((const unsigned char*)s.data(), s.size(), memBuf); @@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { NFs::Remove(tmpFile); fileHash = MD5::File(tmpFile); UNIT_ASSERT_EQUAL(fileHash.size(), 0); - } + } Y_UNIT_TEST(TestIsMD5) { UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf())); @@ -63,4 +63,4 @@ Y_UNIT_TEST_SUITE(TMD5Test) { UNIT_ASSERT_EQUAL(MD5::CalcHalfMix(""), 7203772011789518145ul); UNIT_ASSERT_EQUAL(MD5::CalcHalfMix("qwertyuiopqwertyuiopasdfghjklasdfghjkl"), 11753545595885642730ul); } -} +} |