diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
commit | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch) | |
tree | 506dac10f5df94fab310584ee51b24fc5a081c22 /library/cpp/digest/md5/md5.cpp | |
parent | 2d37894b1b037cf24231090eda8589bbb44fb6fc (diff) | |
download | ydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz |
Restoring authorship annotation for <thegeorg@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 | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eefb..9a28c3d8f37 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -9,11 +9,11 @@ #include <contrib/libs/nayuki_md5/md5.h> namespace { - + constexpr size_t MD5_BLOCK_LENGTH = 64; constexpr size_t MD5_PADDING_SHIFT = 56; - constexpr size_t MD5_HEX_DIGEST_LENGTH = 32; - + constexpr size_t MD5_HEX_DIGEST_LENGTH = 32; + struct TMd5Stream: public IOutputStream { inline TMd5Stream(MD5* md5) : M_(md5) @@ -48,13 +48,13 @@ char* MD5::File(const char* filename, char* buf) { } TString MD5::File(const TString& filename) { - TString buf; - buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); - auto result = MD5::File(filename.data(), buf.begin()); - if (result == nullptr) { - buf.clear(); - } - return buf; + TString buf; + buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); + auto result = MD5::File(filename.data(), buf.begin()); + if (result == nullptr) { + buf.clear(); + } + return buf; } char* MD5::Data(const TArrayRef<const ui8>& data, char* buf) { @@ -66,16 +66,16 @@ char* MD5::Data(const void* data, size_t len, char* buf) { } TString MD5::Data(const TArrayRef<const ui8>& data) { - TString buf; - buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); + TString buf; + buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); Data(data, buf.begin()); - return buf; -} - -TString MD5::Data(TStringBuf data) { + return buf; +} + +TString MD5::Data(TStringBuf data) { return Data(MakeUnsignedArrayRef(data)); -} - +} + char* MD5::Stream(IInputStream* in, char* buf) { return MD5().Update(in).End(buf); } |