diff options
author | romanoved <romanoved@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
commit | 32afff1bad806b1fc774d6ccc979a3dc05a0c7f8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp | |
parent | 90132a2ca55bba6a3adaf9aff8aed49128867d84 (diff) | |
download | ydb-32afff1bad806b1fc774d6ccc979a3dc05a0c7f8.tar.gz |
Restoring authorship annotation for <romanoved@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/actors/helpers/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/actors/interconnect/interconnect_tcp_session.h | 2 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5.cpp | 30 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5.h | 10 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5_ut.cpp | 10 |
5 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/actors/helpers/ya.make b/library/cpp/actors/helpers/ya.make index 2715f1f86c..d8771179de 100644 --- a/library/cpp/actors/helpers/ya.make +++ b/library/cpp/actors/helpers/ya.make @@ -8,7 +8,7 @@ SRCS( flow_controlled_queue.cpp flow_controlled_queue.h future_callback.h - mon_histogram_helper.h + mon_histogram_helper.h selfping_actor.cpp ) diff --git a/library/cpp/actors/interconnect/interconnect_tcp_session.h b/library/cpp/actors/interconnect/interconnect_tcp_session.h index ed26c55cf1..7fc00dbcc5 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_session.h +++ b/library/cpp/actors/interconnect/interconnect_tcp_session.h @@ -268,7 +268,7 @@ namespace NActors { const TDuration DeadPeerTimeout; TInstant LastReceiveTimestamp; void HandleCheckDeadPeer(); - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // pinger logic diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 53f08271d4..24a5b69eef 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -201,17 +201,17 @@ char* MD5::End_b64(char* buf) { return buf; } -ui64 MD5::EndHalfMix() { +ui64 MD5::EndHalfMix() { ui8 digest[16]; - Final(digest); - ui64 res = 0; - for (int i = 3; i >= 0; i--) { - res |= (ui64)(digest[0 + i] ^ digest[8 + i]) << ((3 - i) << 3); - res |= (ui64)(digest[4 + i] ^ digest[12 + i]) << ((7 - i) << 3); - } - return res; -} - + Final(digest); + ui64 res = 0; + for (int i = 3; i >= 0; i--) { + res |= (ui64)(digest[0 + i] ^ digest[8 + i]) << ((3 - i) << 3); + res |= (ui64)(digest[4 + i] ^ digest[12 + i]) << ((7 - i) << 3); + } + return res; +} + TString MD5::Calc(TStringBuf data) { return Calc(MakeUnsignedArrayRef(data)); } @@ -231,14 +231,14 @@ TString MD5::CalcRaw(const TArrayRef<const ui8>& data) { return result; } -ui64 MD5::CalcHalfMix(const char* data, size_t len) { +ui64 MD5::CalcHalfMix(const char* data, size_t len) { return CalcHalfMix(MakeUnsignedArrayRef(data, len)); -} - +} + ui64 MD5::CalcHalfMix(TStringBuf data) { return CalcHalfMix(MakeUnsignedArrayRef(data)); -} - +} + ui64 MD5::CalcHalfMix(const TArrayRef<const ui8>& data) { return MD5().Update(data).EndHalfMix(); } diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h index 74e27cd4ed..2c17aa0518 100644 --- a/library/cpp/digest/md5/md5.h +++ b/library/cpp/digest/md5/md5.h @@ -35,9 +35,9 @@ public: // buf must be char[25]; char* End_b64(char* buf); - // 8-byte xor-based mix - ui64 EndHalfMix(); - + // 8-byte xor-based mix + ui64 EndHalfMix(); + MD5& Update(IInputStream* in); /* @@ -61,8 +61,8 @@ public: static ui64 CalcHalfMix(TStringBuf data); static ui64 CalcHalfMix(const TArrayRef<const ui8>& data); - static ui64 CalcHalfMix(const char* data, size_t len); - + static ui64 CalcHalfMix(const char* data, size_t len); + static bool IsMD5(TStringBuf data); static bool IsMD5(const TArrayRef<const ui8>& data); diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1710d07052..1c3e4ad0a9 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -58,9 +58,9 @@ Y_UNIT_TEST_SUITE(TMD5Test) { 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); - UNIT_ASSERT_EQUAL(MD5::CalcHalfMix("qwertyuiopqwertyuiopasdfghjklasdfghjkl"), 11753545595885642730ul); - } + + Y_UNIT_TEST(TestMd5HalfMix) { + UNIT_ASSERT_EQUAL(MD5::CalcHalfMix(""), 7203772011789518145ul); + UNIT_ASSERT_EQUAL(MD5::CalcHalfMix("qwertyuiopqwertyuiopasdfghjklasdfghjkl"), 11753545595885642730ul); + } } |