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 | 90132a2ca55bba6a3adaf9aff8aed49128867d84 (patch) | |
tree | 31b87b38cf64c8a06dc9225c2627ca5ec2b1aae1 /library/cpp/digest/md5/md5.cpp | |
parent | 62a805381e41500fbc7914c37c71ab040a098f4e (diff) | |
download | ydb-90132a2ca55bba6a3adaf9aff8aed49128867d84.tar.gz |
Restoring authorship annotation for <romanoved@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/md5/md5.cpp')
-rw-r--r-- | library/cpp/digest/md5/md5.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eef..53f08271d4 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(); } |