18 #ifndef CRYPTOPP_BLAKE2_H 19 #define CRYPTOPP_BLAKE2_H 27 template <
bool T_64bit>
53 template <
bool T_64bit>
66 BLAKE2_ParameterBlock()
68 memset(
this, 0x00,
sizeof(*
this));
69 digestLength = DIGESTSIZE;
76 memset(
this, 0x00,
sizeof(*
this));
77 digestLength = (
byte)digestSize;
81 BLAKE2_ParameterBlock(
size_t digestSize,
size_t keyLength,
const byte* salt,
size_t saltLength,
82 const byte* personalization,
size_t personalizationLength);
88 byte nodeDepth, innerLength, rfu[14];
90 byte personalization[PERSONALIZATIONSIZE];
101 BLAKE2_ParameterBlock()
103 memset(
this, 0x00,
sizeof(*
this));
104 digestLength = DIGESTSIZE;
111 memset(
this, 0x00,
sizeof(*
this));
112 digestLength = (
byte)digestSize;
116 BLAKE2_ParameterBlock(
size_t digestSize,
size_t keyLength,
const byte* salt,
size_t saltLength,
117 const byte* personalization,
size_t personalizationLength);
125 byte personalization[PERSONALIZATIONSIZE];
135 template <
class W,
bool T_64bit>
143 h[0]=
h[1]=
h[2]=
h[3]=
h[4]=
h[5]=
h[6]=
h[7] = 0;
144 t[0]=t[1]=
f[0]=
f[1] = 0;
161 template <
class W,
bool T_64bit>
195 void Update(
const byte *input,
size_t length);
217 void TruncatedFinal(
byte *hash,
size_t size);
221 BLAKE2_Base(
bool treeMode,
unsigned int digestSize);
223 const byte* personalization,
size_t personalizationLength,
224 bool treeMode,
unsigned int digestSize);
227 void Compress(
const byte *input);
228 inline void IncrementCounter(
size_t count=BLOCKSIZE);
230 void UncheckedSetKey(
const byte* key,
unsigned int length,
const CryptoPP::NameValuePairs& params);
259 BLAKE2b(
bool treeMode=
false,
unsigned int digestSize = DIGESTSIZE) : ThisBase(treeMode, digestSize) {}
270 BLAKE2b(
const byte *key,
size_t keyLength,
const byte* salt = NULL,
size_t saltLength = 0,
271 const byte* personalization = NULL,
size_t personalizationLength = 0,
272 bool treeMode=
false,
unsigned int digestSize = DIGESTSIZE)
273 : ThisBase(key, keyLength, salt, saltLength, personalization, personalizationLength, treeMode, digestSize) {}
295 BLAKE2s(
bool treeMode=
false,
unsigned int digestSize = DIGESTSIZE) : ThisBase(treeMode, digestSize) {}
306 BLAKE2s(
const byte *key,
size_t keyLength,
const byte* salt = NULL,
size_t saltLength = 0,
307 const byte* personalization = NULL,
size_t personalizationLength = 0,
308 bool treeMode=
false,
unsigned int digestSize = DIGESTSIZE)
309 : ThisBase(key, keyLength, salt, saltLength, personalization, personalizationLength, treeMode, digestSize) {}
BLAKE2_ParameterBlock< false > ParameterBlock
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
#define CRYPTOPP_STATIC_CONSTEXPR
BLAKE2_ParameterBlock< true > ParameterBlock
BLAKE2b(const byte *key, size_t keyLength, const byte *salt=NULL, size_t saltLength=0, const byte *personalization=NULL, size_t personalizationLength=0, bool treeMode=false, unsigned int digestSize=DIGESTSIZE)
Construct a BLAKE2b hash.
BLAKE2 hash implementation.
Provides a base implementation of SimpleKeyingInterface.
#define NAMESPACE_BEGIN(x)
Secure memory block with allocator and cleanup.
Abstract base classes that provide a uniform interface to this library.
VariableKeyLength<(T_64bit?64:32), 0,(T_64bit?64:32), 1, SimpleKeyingInterface::NOT_RESYNCHRONIZABLE > KeyBase
AlignedParameterBlock m_block
AlignedSecByteBlock m_key
BLAKE2s(bool treeMode=false, unsigned int digestSize=DIGESTSIZE)
Construct a BLAKE2s hash.
The BLAKE2s cryptographic hash function.
Allocates a block of memory with cleanup.
Classes and functions for secure memory allocations.
BLAKE2_Base< word64, true > ThisBase
#define CRYPTOPP_COMPILE_ASSERT(assertion)
Classes and functions for implementing secret key algorithms.
BLAKE2_Base< word32, false > ThisBase
Interface for algorithms that take byte strings as keys.
#define CRYPTOPP_BOOL_ALIGN16
BLAKE2_ParameterBlock(size_t digestSize)
#define CRYPTOPP_CONSTANT(x)
#define CRYPTOPP_ASSERT(exp)
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
BLAKE2s parameter block specialization.
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Retrieve the static algorithm name.
Inherited by keyed algorithms with variable key length.
#define CRYPTOPP_NO_VTABLE
BLAKE2 state information.
std::string AlgorithmName() const
Retrieve the object's name.
bool GetTreeMode() const
Get tree mode.
void SetTreeMode(bool mode)
Set tree mode.
uint8_t const size_t const size
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
BLAKE2b(bool treeMode=false, unsigned int digestSize=DIGESTSIZE)
Construct a BLAKE2b hash.
BLAKE2_ParameterBlock(size_t digestSize)
BLAKE2s(const byte *key, size_t keyLength, const byte *salt=NULL, size_t saltLength=0, const byte *personalization=NULL, size_t personalizationLength=0, bool treeMode=false, unsigned int digestSize=DIGESTSIZE)
Construct a BLAKE2s hash.
unsigned int DigestSize() const
Provides the digest size of the hash.
The BLAKE2b cryptographic hash function.
BLAKE2b parameter block specialization.