aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:12 +0300
commit49116032d905455a7b1c994e4a696afc885c1e71 (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /library/cpp/digest
parent4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff)
downloadydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/digest')
-rw-r--r--library/cpp/digest/argonish/internal/blake2b/blake2b.h4
-rw-r--r--library/cpp/digest/md5/md5.cpp36
-rw-r--r--library/cpp/digest/md5/md5.h16
3 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/digest/argonish/internal/blake2b/blake2b.h b/library/cpp/digest/argonish/internal/blake2b/blake2b.h
index 71e1465b57..3dcfc3fc48 100644
--- a/library/cpp/digest/argonish/internal/blake2b/blake2b.h
+++ b/library/cpp/digest/argonish/internal/blake2b/blake2b.h
@@ -35,7 +35,7 @@ namespace NArgonish {
ui8 LastNode;
};
- struct TBlake2BParam {
+ struct TBlake2BParam {
ui8 DigestLen; /* 1 */
ui8 KeyLen; /* 2 */
ui8 Fanout; /* 3 */
@@ -48,7 +48,7 @@ namespace NArgonish {
ui8 Reserved[14]; /* 32 */
ui8 Salt[BLAKE2B_SALTBYTES]; /* 48 */
ui8 Personal[BLAKE2B_PERSONALBYTES]; /* 64 */
- } Y_PACKED;
+ } Y_PACKED;
TBlake2BState State_;
TBlake2BParam Param_;
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp
index 9a28c3d8f3..24a5b69eef 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);
}
diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h
index 674ab9dac0..2c17aa0518 100644
--- a/library/cpp/digest/md5/md5.h
+++ b/library/cpp/digest/md5/md5.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/generic/array_ref.h>
+#include <util/generic/array_ref.h>
#include <util/generic/strbuf.h>
class IInputStream;
@@ -40,18 +40,18 @@ public:
MD5& Update(IInputStream* in);
- /*
- * Return hex-encoded md5 checksum for given file.
- *
- * Return nullptr / empty string if the file does not exist.
- */
+ /*
+ * Return hex-encoded md5 checksum for given file.
+ *
+ * Return nullptr / empty string if the file does not exist.
+ */
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 TArrayRef<const ui8>& data, char* buf);
static TString Data(const TArrayRef<const ui8>& data);
- static TString Data(TStringBuf data);
+ static TString Data(TStringBuf data);
static char* Stream(IInputStream* in, char* buf);
static TString Calc(TStringBuf data); // 32-byte hex-encoded