diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/digest/md5 | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/md5')
-rw-r--r-- | library/cpp/digest/md5/md5.cpp | 16 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5.h | 8 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5_medium_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/digest/md5/md5_ut.cpp | 8 | ||||
-rw-r--r-- | library/cpp/digest/md5/ya.make | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eef..60eda2abea 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -14,7 +14,7 @@ namespace { constexpr size_t MD5_PADDING_SHIFT = 56; constexpr size_t MD5_HEX_DIGEST_LENGTH = 32; - struct TMd5Stream: public IOutputStream { + struct TMd5Stream: public IOutputStream { inline TMd5Stream(MD5* md5) : M_(md5) { @@ -44,7 +44,7 @@ char* MD5::File(const char* filename, char* buf) { } catch (...) { } - return nullptr; + return nullptr; } TString MD5::File(const TString& filename) { @@ -61,7 +61,7 @@ char* MD5::Data(const TArrayRef<const ui8>& data, char* buf) { return MD5().Update(data).End(buf); } -char* MD5::Data(const void* data, size_t len, char* buf) { +char* MD5::Data(const void* data, size_t len, char* buf) { return Data(MakeUnsignedArrayRef(data, len), buf); } @@ -76,11 +76,11 @@ TString MD5::Data(TStringBuf data) { return Data(MakeUnsignedArrayRef(data)); } -char* MD5::Stream(IInputStream* in, char* buf) { +char* MD5::Stream(IInputStream* in, char* buf) { return MD5().Update(in).End(buf); } -MD5& MD5::Update(IInputStream* in) { +MD5& MD5::Update(IInputStream* in) { TMd5Stream md5(this); TransferData(in, &md5); @@ -179,7 +179,7 @@ char* MD5::End(char* buf) { if (!buf) buf = (char*)malloc(33); if (!buf) - return nullptr; + return nullptr; Final(digest); for (ui8 i = 0; i < MD5_HEX_DIGEST_LENGTH / 2; i++) { buf[i * 2] = hex[digest[i] >> 4]; @@ -194,10 +194,10 @@ char* MD5::End_b64(char* buf) { if (!buf) buf = (char*)malloc(25); if (!buf) - return nullptr; + return nullptr; Final(digest); Base64Encode(buf, digest, 16); - buf[24] = '\0'; + buf[24] = '\0'; return buf; } diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h index 2c17aa0518..74c002a82c 100644 --- a/library/cpp/digest/md5/md5.h +++ b/library/cpp/digest/md5/md5.h @@ -3,7 +3,7 @@ #include <util/generic/array_ref.h> #include <util/generic/strbuf.h> -class IInputStream; +class IInputStream; class MD5 { public: @@ -38,7 +38,7 @@ public: // 8-byte xor-based mix ui64 EndHalfMix(); - MD5& Update(IInputStream* in); + MD5& Update(IInputStream* in); /* * Return hex-encoded md5 checksum for given file. @@ -48,11 +48,11 @@ public: static char* File(const char* filename, char* buf); static TString File(const TString& filename); - static char* Data(const void* data, size_t len, char* buf); + static char* Data(const void* data, size_t len, char* buf); static char* Data(const TArrayRef<const ui8>& data, char* buf); static TString Data(const TArrayRef<const ui8>& data); static TString Data(TStringBuf data); - static char* Stream(IInputStream* in, char* buf); + static char* Stream(IInputStream* in, char* buf); static TString Calc(TStringBuf data); // 32-byte hex-encoded static TString Calc(const TArrayRef<const ui8>& data); // 32-byte hex-encoded diff --git a/library/cpp/digest/md5/md5_medium_ut.cpp b/library/cpp/digest/md5/md5_medium_ut.cpp index a940c5cb66..4ea147ff36 100644 --- a/library/cpp/digest/md5/md5_medium_ut.cpp +++ b/library/cpp/digest/md5/md5_medium_ut.cpp @@ -2,8 +2,8 @@ #include <library/cpp/testing/unittest/registar.h> -Y_UNIT_TEST_SUITE(TMD5MediumTest) { - Y_UNIT_TEST(TestOverflow) { +Y_UNIT_TEST_SUITE(TMD5MediumTest) { + Y_UNIT_TEST(TestOverflow) { if (sizeof(size_t) > sizeof(unsigned int)) { const size_t maxUi32 = (size_t)Max<unsigned int>(); TArrayHolder<char> buf(new char[maxUi32]); diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9..7c955f2f5a 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -5,8 +5,8 @@ #include <util/system/fs.h> #include <util/stream/file.h> -Y_UNIT_TEST_SUITE(TMD5Test) { - Y_UNIT_TEST(TestMD5) { +Y_UNIT_TEST_SUITE(TMD5Test) { + Y_UNIT_TEST(TestMD5) { // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; @@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); } - Y_UNIT_TEST(TestFile) { + Y_UNIT_TEST(TestFile) { TString s = NUnitTest::RandomString(1000000, 1); const TString tmpFile = "tmp"; @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { UNIT_ASSERT_EQUAL(fileHash.size(), 0); } - Y_UNIT_TEST(TestIsMD5) { + Y_UNIT_TEST(TestIsMD5) { UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf())); UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0"))); // length 31 UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa000"))); // length 33 diff --git a/library/cpp/digest/md5/ya.make b/library/cpp/digest/md5/ya.make index c09ec1c326..16575b3926 100644 --- a/library/cpp/digest/md5/ya.make +++ b/library/cpp/digest/md5/ya.make @@ -9,9 +9,9 @@ SRCS( md5.cpp ) -PEERDIR( +PEERDIR( contrib/libs/nayuki_md5 library/cpp/string_utils/base64 -) - +) + END() |