2016-05-11 19:07:29 +00:00
|
|
|
// blake2.h - written and placed in the public domain by Jeffrey Walton and Zooko
|
2017-02-21 07:54:09 +00:00
|
|
|
// Wilcox-O'Hearn. Based on Aumasson, Neves, Wilcox-O'Hearn and Winnerlein's
|
|
|
|
// reference BLAKE2 implementation at http://github.com/BLAKE2/BLAKE2.
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
//! \file blake2.h
|
|
|
|
//! \brief Classes for BLAKE2b and BLAKE2s message digests and keyed message digests
|
2016-12-27 17:34:57 +00:00
|
|
|
//! \details This implementation follows Aumasson, Neves, Wilcox-O'Hearn and Winnerlein's
|
2016-04-17 07:06:28 +00:00
|
|
|
//! <A HREF="http://blake2.net/blake2.pdf">BLAKE2: simpler, smaller, fast as MD5</A> (2013.01.29).
|
2016-05-20 16:36:25 +00:00
|
|
|
//! Static algorithm name return either "BLAKE2b" or "BLAKE2s". An object algorithm name follows
|
2016-04-17 07:06:28 +00:00
|
|
|
//! the naming described in <A HREF="http://tools.ietf.org/html/rfc7693#section-4">RFC 7693, The
|
|
|
|
//! BLAKE2 Cryptographic Hash and Message Authentication Code (MAC)</A>.
|
2016-05-11 19:07:29 +00:00
|
|
|
//! \details The library provides specialized SSE2, SSE4 and NEON version of the BLAKE2 compression
|
|
|
|
//! function. For best results under ARM NEON, specify both an architecture and cpu. For example:
|
2016-05-20 16:36:25 +00:00
|
|
|
//! <pre>CXXFLAGS="-DNDEBUG -march=armv8-a+crc -mcpu=cortex-a53 ..."</pre>
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
#ifndef CRYPTOPP_BLAKE2_H
|
|
|
|
#define CRYPTOPP_BLAKE2_H
|
|
|
|
|
|
|
|
#include "cryptlib.h"
|
|
|
|
#include "secblock.h"
|
|
|
|
#include "seckey.h"
|
|
|
|
|
|
|
|
NAMESPACE_BEGIN(CryptoPP)
|
|
|
|
|
|
|
|
//! \class BLAKE2_Info
|
|
|
|
//! \brief BLAKE2 hash information
|
|
|
|
//! \tparam T_64bit flag indicating 64-bit
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
template <bool T_64bit>
|
2016-07-01 00:55:56 +00:00
|
|
|
struct BLAKE2_Info : public VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
|
2016-04-17 07:06:28 +00:00
|
|
|
{
|
2016-04-22 22:09:47 +00:00
|
|
|
typedef VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE> KeyBase;
|
2016-06-08 20:46:51 +00:00
|
|
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = KeyBase::MIN_KEYLENGTH)
|
|
|
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = KeyBase::MAX_KEYLENGTH)
|
|
|
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = KeyBase::DEFAULT_KEYLENGTH)
|
2016-04-18 04:46:59 +00:00
|
|
|
|
2016-04-17 07:06:28 +00:00
|
|
|
CRYPTOPP_CONSTANT(BLOCKSIZE = (T_64bit ? 128 : 64))
|
|
|
|
CRYPTOPP_CONSTANT(DIGESTSIZE = (T_64bit ? 64 : 32))
|
|
|
|
CRYPTOPP_CONSTANT(SALTSIZE = (T_64bit ? 16 : 8))
|
|
|
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = (T_64bit ? 16 : 8))
|
|
|
|
|
2016-12-01 14:37:04 +00:00
|
|
|
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return (T_64bit ? "BLAKE2b" : "BLAKE2s");}
|
2016-04-17 07:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//! \class BLAKE2_ParameterBlock
|
|
|
|
//! \brief BLAKE2 parameter block
|
|
|
|
//! \tparam T_64bit flag indicating 64-bit
|
|
|
|
//! \details BLAKE2b uses BLAKE2_ParameterBlock<true>, while BLAKE2s
|
|
|
|
//! uses BLAKE2_ParameterBlock<false>.
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
template <bool T_64bit>
|
|
|
|
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
//! \brief BLAKE2b parameter block specialization
|
|
|
|
template<>
|
|
|
|
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<true>
|
|
|
|
{
|
2016-06-08 20:46:51 +00:00
|
|
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<true>::SALTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<true>::DIGESTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<true>::PERSONALIZATIONSIZE)
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
BLAKE2_ParameterBlock()
|
|
|
|
{
|
|
|
|
memset(this, 0x00, sizeof(*this));
|
|
|
|
digestLength = DIGESTSIZE;
|
|
|
|
fanout = depth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLAKE2_ParameterBlock(size_t digestSize)
|
|
|
|
{
|
2016-09-16 15:27:15 +00:00
|
|
|
CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
|
2016-04-17 07:06:28 +00:00
|
|
|
memset(this, 0x00, sizeof(*this));
|
|
|
|
digestLength = (byte)digestSize;
|
|
|
|
fanout = depth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLAKE2_ParameterBlock(size_t digestSize, size_t keyLength, const byte* salt, size_t saltLength,
|
|
|
|
const byte* personalization, size_t personalizationLength);
|
|
|
|
|
2016-04-23 00:31:18 +00:00
|
|
|
byte digestLength;
|
|
|
|
byte keyLength, fanout, depth;
|
2016-04-17 07:06:28 +00:00
|
|
|
byte leafLength[4];
|
|
|
|
byte nodeOffset[8];
|
|
|
|
byte nodeDepth, innerLength, rfu[14];
|
|
|
|
byte salt[SALTSIZE];
|
|
|
|
byte personalization[PERSONALIZATIONSIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
//! \brief BLAKE2s parameter block specialization
|
|
|
|
template<>
|
|
|
|
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<false>
|
|
|
|
{
|
2016-06-08 20:46:51 +00:00
|
|
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<false>::SALTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<false>::DIGESTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<false>::PERSONALIZATIONSIZE)
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
BLAKE2_ParameterBlock()
|
|
|
|
{
|
|
|
|
memset(this, 0x00, sizeof(*this));
|
|
|
|
digestLength = DIGESTSIZE;
|
|
|
|
fanout = depth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLAKE2_ParameterBlock(size_t digestSize)
|
|
|
|
{
|
2016-09-16 15:27:15 +00:00
|
|
|
CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
|
2016-04-17 07:06:28 +00:00
|
|
|
memset(this, 0x00, sizeof(*this));
|
|
|
|
digestLength = (byte)digestSize;
|
|
|
|
fanout = depth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLAKE2_ParameterBlock(size_t digestSize, size_t keyLength, const byte* salt, size_t saltLength,
|
|
|
|
const byte* personalization, size_t personalizationLength);
|
|
|
|
|
2016-04-23 00:31:18 +00:00
|
|
|
byte digestLength;
|
|
|
|
byte keyLength, fanout, depth;
|
2016-04-17 07:06:28 +00:00
|
|
|
byte leafLength[4];
|
|
|
|
byte nodeOffset[6];
|
|
|
|
byte nodeDepth, innerLength;
|
|
|
|
byte salt[SALTSIZE];
|
|
|
|
byte personalization[PERSONALIZATIONSIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
//! \class BLAKE2_State
|
|
|
|
//! \brief BLAKE2 state information
|
|
|
|
//! \tparam W word type
|
|
|
|
//! \tparam T_64bit flag indicating 64-bit
|
|
|
|
//! \details BLAKE2b uses BLAKE2_State<word64, true>, while BLAKE2s
|
|
|
|
//! uses BLAKE2_State<word32, false>.
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
template <class W, bool T_64bit>
|
|
|
|
struct CRYPTOPP_NO_VTABLE BLAKE2_State
|
|
|
|
{
|
2016-06-08 20:46:51 +00:00
|
|
|
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE)
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
BLAKE2_State()
|
|
|
|
{
|
2016-04-23 00:31:18 +00:00
|
|
|
// Set all members except scratch buffer[]
|
2016-04-23 00:40:40 +00:00
|
|
|
h[0]=h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7] = 0;
|
|
|
|
t[0]=t[1]=f[0]=f[1] = 0;
|
|
|
|
length = 0;
|
2016-04-17 07:06:28 +00:00
|
|
|
}
|
|
|
|
|
2016-05-11 19:07:29 +00:00
|
|
|
// SSE2, SSE4 and NEON depend upon t[] and f[] being side-by-side
|
2016-05-17 12:08:40 +00:00
|
|
|
W h[8], t[2], f[2];
|
|
|
|
byte buffer[BLOCKSIZE];
|
2016-05-19 08:18:35 +00:00
|
|
|
size_t length;
|
2016-04-17 07:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//! \class BLAKE2_Base
|
|
|
|
//! \brief BLAKE2 hash implementation
|
|
|
|
//! \tparam W word type
|
|
|
|
//! \tparam T_64bit flag indicating 64-bit
|
|
|
|
//! \details BLAKE2b uses BLAKE2_Base<word64, true>, while BLAKE2s
|
|
|
|
//! uses BLAKE2_Base<word32, false>.
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
template <class W, bool T_64bit>
|
2016-04-17 14:48:26 +00:00
|
|
|
class BLAKE2_Base : public SimpleKeyingInterfaceImpl<MessageAuthenticationCode, BLAKE2_Info<T_64bit> >
|
2016-04-17 07:06:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-06-08 20:46:51 +00:00
|
|
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = BLAKE2_Info<T_64bit>::DEFAULT_KEYLENGTH)
|
|
|
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = BLAKE2_Info<T_64bit>::MIN_KEYLENGTH)
|
|
|
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = BLAKE2_Info<T_64bit>::MAX_KEYLENGTH)
|
|
|
|
|
|
|
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<T_64bit>::DIGESTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<T_64bit>::SALTSIZE)
|
|
|
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<T_64bit>::PERSONALIZATIONSIZE)
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
typedef BLAKE2_State<W, T_64bit> State;
|
2016-07-01 00:55:56 +00:00
|
|
|
typedef BLAKE2_ParameterBlock<T_64bit> ParameterBlock;
|
|
|
|
typedef SecBlock<State, AllocatorWithCleanup<State, true> > AlignedState;
|
|
|
|
typedef SecBlock<ParameterBlock, AllocatorWithCleanup<ParameterBlock, true> > AlignedParameterBlock;
|
2016-04-17 07:06:28 +00:00
|
|
|
|
2016-07-01 01:09:48 +00:00
|
|
|
virtual ~BLAKE2_Base() {}
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
//! \brief Retrieve the static algorithm name
|
2016-05-07 12:08:40 +00:00
|
|
|
//! \returns the algorithm name (BLAKE2s or BLAKE2b)
|
2016-12-01 14:37:04 +00:00
|
|
|
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return BLAKE2_Info<T_64bit>::StaticAlgorithmName();}
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
//! \brief Retrieve the object's name
|
2016-05-07 12:08:40 +00:00
|
|
|
//! \returns the object's algorithm name following RFC 7693
|
2016-04-17 07:06:28 +00:00
|
|
|
//! \details Object algorithm name follows the naming described in
|
|
|
|
//! <A HREF="http://tools.ietf.org/html/rfc7693#section-4">RFC 7693, The BLAKE2 Cryptographic Hash and
|
|
|
|
//! Message Authentication Code (MAC)</A>. For example, "BLAKE2b-512" and "BLAKE2s-256".
|
|
|
|
std::string AlgorithmName() const {return std::string(StaticAlgorithmName()) + "-" + IntToString(this->DigestSize()*8);}
|
|
|
|
|
|
|
|
unsigned int DigestSize() const {return m_digestSize;}
|
2016-05-17 12:08:40 +00:00
|
|
|
unsigned int OptimalDataAlignment() const {return (CRYPTOPP_BOOL_ALIGN16 ? 16 : GetAlignmentOf<W>());}
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
void Update(const byte *input, size_t length);
|
|
|
|
void Restart();
|
|
|
|
|
|
|
|
//! \brief Restart a hash with parameter block and counter
|
2016-12-27 17:34:57 +00:00
|
|
|
//! \param block parameter block
|
2016-04-17 07:06:28 +00:00
|
|
|
//! \param counter counter array
|
|
|
|
//! \details Parameter block is persisted across calls to Restart().
|
|
|
|
void Restart(const BLAKE2_ParameterBlock<T_64bit>& block, const W counter[2]);
|
|
|
|
|
|
|
|
//! \brief Set tree mode
|
|
|
|
//! \param mode the new tree mode
|
|
|
|
//! \details BLAKE2 has two finalization flags, called State::f[0] and State::f[1].
|
|
|
|
//! If <tt>treeMode=false</tt> (default), then State::f[1] is never set. If
|
|
|
|
//! <tt>treeMode=true</tt>, then State::f[1] is set when State::f[0] is set.
|
|
|
|
//! Tree mode is persisted across calls to Restart().
|
|
|
|
void SetTreeMode(bool mode) {m_treeMode=mode;}
|
|
|
|
|
|
|
|
//! \brief Get tree mode
|
|
|
|
//! \returns the current tree mode
|
|
|
|
//! \details Tree mode is persisted across calls to Restart().
|
|
|
|
bool GetTreeMode() const {return m_treeMode;}
|
|
|
|
|
|
|
|
void TruncatedFinal(byte *hash, size_t size);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BLAKE2_Base();
|
|
|
|
BLAKE2_Base(bool treeMode, unsigned int digestSize);
|
|
|
|
BLAKE2_Base(const byte *key, size_t keyLength, const byte* salt, size_t saltLength,
|
|
|
|
const byte* personalization, size_t personalizationLength,
|
|
|
|
bool treeMode, unsigned int digestSize);
|
|
|
|
|
|
|
|
// Operates on state buffer and/or input. Must be BLOCKSIZE, final block will pad with 0's.
|
|
|
|
void Compress(const byte *input);
|
|
|
|
inline void IncrementCounter(size_t count=BLOCKSIZE);
|
|
|
|
|
|
|
|
void UncheckedSetKey(const byte* key, unsigned int length, const CryptoPP::NameValuePairs& params);
|
|
|
|
|
|
|
|
private:
|
2016-07-01 00:55:56 +00:00
|
|
|
AlignedState m_state;
|
|
|
|
AlignedParameterBlock m_block;
|
2016-04-17 07:06:28 +00:00
|
|
|
AlignedSecByteBlock m_key;
|
|
|
|
word32 m_digestSize;
|
|
|
|
bool m_treeMode;
|
|
|
|
};
|
|
|
|
|
|
|
|
//! \brief The BLAKE2b cryptographic hash function
|
|
|
|
//! \details BLAKE2b can function as both a hash and keyed hash. If you want only the hash,
|
|
|
|
//! then use the BLAKE2b constructor that accepts no parameters or digest size. If you
|
2016-12-27 17:34:57 +00:00
|
|
|
//! want a keyed hash, then use the constructor that accpts the key as a parameter.
|
2016-04-17 07:06:28 +00:00
|
|
|
//! Once a key and digest size are selected, its effectively immutable. The Restart()
|
|
|
|
//! method that accepts a ParameterBlock does not allow you to change it.
|
2016-05-20 16:36:25 +00:00
|
|
|
//! \sa Aumasson, Neves, Wilcox-O'Hearn and Winnerlein's
|
2016-04-17 07:06:28 +00:00
|
|
|
//! <A HREF="http://blake2.net/blake2.pdf">BLAKE2: simpler, smaller, fast as MD5</A> (2013.01.29).
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
class BLAKE2b : public BLAKE2_Base<word64, true>
|
|
|
|
{
|
|
|
|
public:
|
2016-04-18 04:46:59 +00:00
|
|
|
typedef BLAKE2_Base<word64, true> ThisBase; // Early Visual Studio workaround
|
2016-04-17 07:06:28 +00:00
|
|
|
typedef BLAKE2_ParameterBlock<true> ParameterBlock;
|
|
|
|
CRYPTOPP_COMPILE_ASSERT(sizeof(ParameterBlock) == 64);
|
|
|
|
|
|
|
|
//! \brief Construct a BLAKE2b hash
|
|
|
|
//! \param digestSize the digest size, in bytes
|
2016-04-20 23:03:46 +00:00
|
|
|
//! \param treeMode flag indicating tree mode
|
2016-04-18 04:46:59 +00:00
|
|
|
BLAKE2b(bool treeMode=false, unsigned int digestSize = DIGESTSIZE) : ThisBase(treeMode, digestSize) {}
|
2016-04-17 07:06:28 +00:00
|
|
|
|
|
|
|
//! \brief Construct a BLAKE2b hash
|
|
|
|
//! \param key a byte array used to key the cipher
|
|
|
|
//! \param keyLength the size of the byte array
|
|
|
|
//! \param salt a byte array used as salt
|
|
|
|
//! \param saltLength the size of the byte array
|
|
|
|
//! \param personalization a byte array used as prsonalization string
|
|
|
|
//! \param personalizationLength the size of the byte array
|
|
|
|
//! \param treeMode flag indicating tree mode
|
|
|
|
//! \param digestSize the digest size, in bytes
|
2017-03-01 11:10:06 +00:00
|
|
|
BLAKE2b(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0,
|
|
|
|
const byte* personalization = NULLPTR, size_t personalizationLength = 0,
|
2016-04-17 07:06:28 +00:00
|
|
|
bool treeMode=false, unsigned int digestSize = DIGESTSIZE)
|
2016-04-18 04:46:59 +00:00
|
|
|
: ThisBase(key, keyLength, salt, saltLength, personalization, personalizationLength, treeMode, digestSize) {}
|
2016-04-17 07:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//! \brief The BLAKE2s cryptographic hash function
|
|
|
|
//! \details BLAKE2s can function as both a hash and keyed hash. If you want only the hash,
|
|
|
|
//! then use the BLAKE2s constructor that accepts no parameters or digest size. If you
|
2016-12-27 17:34:57 +00:00
|
|
|
//! want a keyed hash, then use the constructor that accpts the key as a parameter.
|
2016-04-17 07:06:28 +00:00
|
|
|
//! Once a key and digest size are selected, its effectively immutable. The Restart()
|
|
|
|
//! method that accepts a ParameterBlock does not allow you to change it.
|
2016-05-20 16:36:25 +00:00
|
|
|
//! \sa Aumasson, Neves, Wilcox-O'Hearn and Winnerlein's
|
2016-04-17 07:06:28 +00:00
|
|
|
//! <A HREF="http://blake2.net/blake2.pdf">BLAKE2: simpler, smaller, fast as MD5</A> (2013.01.29).
|
2016-09-09 09:19:29 +00:00
|
|
|
//! \since Crypto++ 5.6.4
|
2016-04-17 07:06:28 +00:00
|
|
|
class BLAKE2s : public BLAKE2_Base<word32, false>
|
|
|
|
{
|
|
|
|
public:
|
2016-04-18 04:46:59 +00:00
|
|
|
typedef BLAKE2_Base<word32, false> ThisBase; // Early Visual Studio workaround
|
2016-04-17 07:06:28 +00:00
|
|
|
typedef BLAKE2_ParameterBlock<false> ParameterBlock;
|
|
|
|
CRYPTOPP_COMPILE_ASSERT(sizeof(ParameterBlock) == 32);
|
|
|
|
|
2016-04-25 01:01:22 +00:00
|
|
|
//! \brief Construct a BLAKE2s hash
|
2016-04-17 07:06:28 +00:00
|
|
|
//! \param digestSize the digest size, in bytes
|
2016-04-20 23:03:46 +00:00
|
|
|
//! \param treeMode flag indicating tree mode
|
2016-04-18 04:46:59 +00:00
|
|
|
BLAKE2s(bool treeMode=false, unsigned int digestSize = DIGESTSIZE) : ThisBase(treeMode, digestSize) {}
|
2016-04-17 07:06:28 +00:00
|
|
|
|
2016-04-25 01:01:22 +00:00
|
|
|
//! \brief Construct a BLAKE2s hash
|
2016-04-17 07:06:28 +00:00
|
|
|
//! \param key a byte array used to key the cipher
|
|
|
|
//! \param keyLength the size of the byte array
|
|
|
|
//! \param salt a byte array used as salt
|
|
|
|
//! \param saltLength the size of the byte array
|
|
|
|
//! \param personalization a byte array used as prsonalization string
|
|
|
|
//! \param personalizationLength the size of the byte array
|
|
|
|
//! \param treeMode flag indicating tree mode
|
|
|
|
//! \param digestSize the digest size, in bytes
|
2017-03-01 11:10:06 +00:00
|
|
|
BLAKE2s(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0,
|
|
|
|
const byte* personalization = NULLPTR, size_t personalizationLength = 0,
|
2016-04-17 07:06:28 +00:00
|
|
|
bool treeMode=false, unsigned int digestSize = DIGESTSIZE)
|
2016-04-18 04:46:59 +00:00
|
|
|
: ThisBase(key, keyLength, salt, saltLength, personalization, personalizationLength, treeMode, digestSize) {}
|
2016-04-17 07:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|