Add missing BLAKE2 constructors
BLAKE2b and BLAKE2s are both missing a constructor that takes only the digest size. Also see https://groups.google.com/d/msg/cryptopp-users/QCFGYw8q3Yo/vpBCqz-vBgAJpull/815/head
parent
758939ab2e
commit
3183970300
20
blake2.cpp
20
blake2.cpp
|
|
@ -343,6 +343,26 @@ BLAKE2b::BLAKE2b(bool treeMode, unsigned int digestSize)
|
|||
(Name::TreeMode(), treeMode));
|
||||
}
|
||||
|
||||
BLAKE2s::BLAKE2s(unsigned int digestSize)
|
||||
: m_digestSize(digestSize), m_keyLength(0), m_treeMode(false)
|
||||
{
|
||||
CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
|
||||
|
||||
UncheckedSetKey(NULLPTR, 0, MakeParameters
|
||||
(Name::DigestSize(), (int)digestSize)
|
||||
(Name::TreeMode(), false));
|
||||
}
|
||||
|
||||
BLAKE2b::BLAKE2b(unsigned int digestSize)
|
||||
: m_digestSize(digestSize), m_keyLength(0), m_treeMode(false)
|
||||
{
|
||||
CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
|
||||
|
||||
UncheckedSetKey(NULLPTR, 0, MakeParameters
|
||||
(Name::DigestSize(), (int)digestSize)
|
||||
(Name::TreeMode(), false));
|
||||
}
|
||||
|
||||
BLAKE2s::BLAKE2s(const byte *key, size_t keyLength, const byte* salt, size_t saltLength,
|
||||
const byte* personalization, size_t personalizationLength, bool treeMode, unsigned int digestSize)
|
||||
: m_digestSize(digestSize), m_keyLength(static_cast<unsigned int>(keyLength)), m_treeMode(treeMode)
|
||||
|
|
|
|||
16
blake2.h
16
blake2.h
|
|
@ -256,8 +256,15 @@ public:
|
|||
/// \brief Construct a BLAKE2s hash
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \param treeMode flag indicating tree mode
|
||||
/// \since Crypto++ 5.6.4
|
||||
BLAKE2s(bool treeMode=false, unsigned int digestSize = DIGESTSIZE);
|
||||
|
||||
/// \brief Construct a BLAKE2s hash
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \details treeMode flag is set to false
|
||||
/// \since Crypto++ 8.2
|
||||
BLAKE2s(unsigned int digestSize);
|
||||
|
||||
/// \brief Construct a BLAKE2s hash
|
||||
/// \param key a byte array used to key the cipher
|
||||
/// \param keyLength the size of the byte array
|
||||
|
|
@ -267,6 +274,7 @@ public:
|
|||
/// \param personalizationLength the size of the byte array
|
||||
/// \param treeMode flag indicating tree mode
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \since Crypto++ 5.6.4
|
||||
BLAKE2s(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0,
|
||||
const byte* personalization = NULLPTR, size_t personalizationLength = 0,
|
||||
bool treeMode=false, unsigned int digestSize = DIGESTSIZE);
|
||||
|
|
@ -355,8 +363,15 @@ public:
|
|||
/// \brief Construct a BLAKE2b hash
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \param treeMode flag indicating tree mode
|
||||
/// \since Crypto++ 5.6.4
|
||||
BLAKE2b(bool treeMode=false, unsigned int digestSize = DIGESTSIZE);
|
||||
|
||||
/// \brief Construct a BLAKE2s hash
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \details treeMode flag is set to false
|
||||
/// \since Crypto++ 8.2
|
||||
BLAKE2b(unsigned int digestSize);
|
||||
|
||||
/// \brief Construct a BLAKE2b hash
|
||||
/// \param key a byte array used to key the cipher
|
||||
/// \param keyLength the size of the byte array
|
||||
|
|
@ -366,6 +381,7 @@ public:
|
|||
/// \param personalizationLength the size of the byte array
|
||||
/// \param treeMode flag indicating tree mode
|
||||
/// \param digestSize the digest size, in bytes
|
||||
/// \since Crypto++ 5.6.4
|
||||
BLAKE2b(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0,
|
||||
const byte* personalization = NULLPTR, size_t personalizationLength = 0,
|
||||
bool treeMode=false, unsigned int digestSize = DIGESTSIZE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue