diff options
author | aropan <aropan@yandex-team.ru> | 2022-02-10 16:50:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:14 +0300 |
commit | 8b7dce1ea48c8a811ae189088c265b2da7600e98 (patch) | |
tree | 76ce17d16e613e00af5abcceb21c6c1b3037feab | |
parent | 5014e8b2e7e17987c50a1b761cee7447f22e006c (diff) | |
download | ydb-8b7dce1ea48c8a811ae189088c265b2da7600e98.tar.gz |
Restoring authorship annotation for <aropan@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/digest/md5/md5.cpp | 18 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5.h | 2 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5_ut.cpp | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eef..f4692cd802 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -4,7 +4,7 @@ #include <util/stream/input.h> #include <util/stream/file.h> -#include <util/string/hex.h> +#include <util/string/hex.h> #include <contrib/libs/nayuki_md5/md5.h> @@ -230,7 +230,7 @@ TString MD5::CalcRaw(const TArrayRef<const ui8>& data) { MD5().Update(data).Final(reinterpret_cast<ui8*>(result.begin())); return result; } - + ui64 MD5::CalcHalfMix(const char* data, size_t len) { return CalcHalfMix(MakeUnsignedArrayRef(data, len)); } @@ -249,12 +249,12 @@ bool MD5::IsMD5(TStringBuf data) { bool MD5::IsMD5(const TArrayRef<const ui8>& data) { if (data.size() != 32) { - return false; - } + return false; + } for (const ui8 *p = data.data(), *e = data.data() + data.size(); p != e; ++p) { if (Char2DigitTable[*p] == '\xff') { - return false; - } - } - return true; -} + return false; + } + } + return true; +} diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h index 2c17aa0518..35c5c90a4c 100644 --- a/library/cpp/digest/md5/md5.h +++ b/library/cpp/digest/md5/md5.h @@ -65,7 +65,7 @@ public: static bool IsMD5(TStringBuf data); static bool IsMD5(const TArrayRef<const ui8>& data); - + private: void UpdatePart(TArrayRef<const ui8> data); diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9..b3a7a20f57 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -48,7 +48,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { fileHash = MD5::File(tmpFile); UNIT_ASSERT_EQUAL(fileHash.size(), 0); } - + Y_UNIT_TEST(TestIsMD5) { UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf())); UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0"))); // length 31 @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136EBB0E4C45D21E2B09294C75CFA08"))); UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0E4C45D21e2b09294C75CfA08"))); UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa08"))); - } + } Y_UNIT_TEST(TestMd5HalfMix) { UNIT_ASSERT_EQUAL(MD5::CalcHalfMix(""), 7203772011789518145ul); |