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/digest/md5/md5.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/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 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(); } |