aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/md5/md5_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/digest/md5/md5_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/md5/md5_ut.cpp')
-rw-r--r--library/cpp/digest/md5/md5_ut.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp
index 1c3e4ad0a9..8216fa463a 100644
--- a/library/cpp/digest/md5/md5_ut.cpp
+++ b/library/cpp/digest/md5/md5_ut.cpp
@@ -1,44 +1,44 @@
-#include "md5.h"
-
+#include "md5.h"
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/fs.h>
-#include <util/stream/file.h>
-
+#include <util/system/fs.h>
+#include <util/stream/file.h>
+
Y_UNIT_TEST_SUITE(TMD5Test) {
Y_UNIT_TEST(TestMD5) {
// 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);
-
+
char rs[33];
TString s(r.End(rs));
s.to_lower();
-
+
UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f"));
-
+
TString result = r.Calc(TStringBuf(b));
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];
TString fileHash = MD5::File(tmpFile.data(), fileBuf);
TString memoryHash = MD5::Data((const unsigned char*)s.data(), s.size(), memBuf);
-
+
UNIT_ASSERT_NO_DIFF(fileHash, memoryHash);
fileHash = MD5::File(tmpFile);