diff options
author | e-sidorov <e-sidorov@yandex-team.ru> | 2022-02-10 16:46:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:06 +0300 |
commit | ce2ad6f6a6f6025e37fb7f8debe7cefd3aa2307c (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/digest/argonish/blake2b.h | |
parent | 1ec091f8998d76a211c6015ba6865a73b29d676a (diff) | |
download | ydb-ce2ad6f6a6f6025e37fb7f8debe7cefd3aa2307c.tar.gz |
Restoring authorship annotation for <e-sidorov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/digest/argonish/blake2b.h')
-rw-r--r-- | library/cpp/digest/argonish/blake2b.h | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/library/cpp/digest/argonish/blake2b.h b/library/cpp/digest/argonish/blake2b.h index 559f0b5580..21ca468423 100644 --- a/library/cpp/digest/argonish/blake2b.h +++ b/library/cpp/digest/argonish/blake2b.h @@ -1,78 +1,78 @@ -#pragma once - -#include "common.h" - -#include <util/generic/ptr.h> - -namespace NArgonish { - /** - * Interface for all Blake2B instances - */ - class IBlake2Base { - public: - virtual ~IBlake2Base() { - } - /** - * Updates intermediate hash with an ui32 value - * @param in integer to hash - */ - virtual void Update(ui32 in) = 0; - - /** - * Updates intermediate hash with an array of bytes - * @param pin input - * @param inlen input length - */ - virtual void Update(const void* pin, size_t inlen) = 0; - - /** - * Finalizes the hash calculation and returns the hash value - * @param out output buffer - * @param outlen output buffer length - */ - virtual void Final(void* out, size_t outlen) = 0; - }; - - /** - * A factory that creates Blake2B instances optimized for different instruction sets - */ - class TBlake2BFactory { - public: - /** - * Constructs the factory object - * @param skipTest if true then the constructor skips runtime Blake2B test - */ - TBlake2BFactory(bool skipTest = false); - - /** - * Creates an instance of Blake2B hash algorithm. - * The optimisation is selected automatically based on the cpuid instruction output. - * @param outlen the output buffer length, this value takes part in hashing - * @param key a secret key to make Blake2B work as a keyed hash function - * @param keylen the secret key length - * @return returns an unique_ptr containing Blake2B instance - */ - THolder<IBlake2Base> Create(size_t outlen = 32, const ui8* key = nullptr, size_t keylen = 0) const; - - /** - * Creates an instance of Blake2B hash algorithm optimized for the particular instruction set - * @param instructionSet instruction set - * @param outlen the output buffer length, this value takes part in hashing - * @param key a secret key to make Blake2B work as a keyed hash function - * @param keylen the secret key length - * @return returns an unique_ptr containing Blake2B instance - */ - THolder<IBlake2Base> Create(EInstructionSet instructionSet, size_t outlen = 32, - const ui8* key = nullptr, size_t keylen = 0) const; - - /** - * The function returns the best instruction set available on the current CPU - * @return InstructionSet value - */ - EInstructionSet GetInstructionSet() const; - - protected: - EInstructionSet InstructionSet_ = EInstructionSet::REF; - void QuickTest_() const; - }; -} +#pragma once + +#include "common.h" + +#include <util/generic/ptr.h> + +namespace NArgonish { + /** + * Interface for all Blake2B instances + */ + class IBlake2Base { + public: + virtual ~IBlake2Base() { + } + /** + * Updates intermediate hash with an ui32 value + * @param in integer to hash + */ + virtual void Update(ui32 in) = 0; + + /** + * Updates intermediate hash with an array of bytes + * @param pin input + * @param inlen input length + */ + virtual void Update(const void* pin, size_t inlen) = 0; + + /** + * Finalizes the hash calculation and returns the hash value + * @param out output buffer + * @param outlen output buffer length + */ + virtual void Final(void* out, size_t outlen) = 0; + }; + + /** + * A factory that creates Blake2B instances optimized for different instruction sets + */ + class TBlake2BFactory { + public: + /** + * Constructs the factory object + * @param skipTest if true then the constructor skips runtime Blake2B test + */ + TBlake2BFactory(bool skipTest = false); + + /** + * Creates an instance of Blake2B hash algorithm. + * The optimisation is selected automatically based on the cpuid instruction output. + * @param outlen the output buffer length, this value takes part in hashing + * @param key a secret key to make Blake2B work as a keyed hash function + * @param keylen the secret key length + * @return returns an unique_ptr containing Blake2B instance + */ + THolder<IBlake2Base> Create(size_t outlen = 32, const ui8* key = nullptr, size_t keylen = 0) const; + + /** + * Creates an instance of Blake2B hash algorithm optimized for the particular instruction set + * @param instructionSet instruction set + * @param outlen the output buffer length, this value takes part in hashing + * @param key a secret key to make Blake2B work as a keyed hash function + * @param keylen the secret key length + * @return returns an unique_ptr containing Blake2B instance + */ + THolder<IBlake2Base> Create(EInstructionSet instructionSet, size_t outlen = 32, + const ui8* key = nullptr, size_t keylen = 0) const; + + /** + * The function returns the best instruction set available on the current CPU + * @return InstructionSet value + */ + EInstructionSet GetInstructionSet() const; + + protected: + EInstructionSet InstructionSet_ = EInstructionSet::REF; + void QuickTest_() const; + }; +} |