mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Use blake2b as hash for random generator from Argon2 is used.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "Hash.h"
|
||||
|
||||
#include "Crypto/blake2.h"
|
||||
#include "Crypto/blake2s.h"
|
||||
#include "Crypto/Sha2.h"
|
||||
#include "Crypto/Whirlpool.h"
|
||||
#include "Crypto/Streebog.h"
|
||||
@@ -27,7 +27,7 @@ namespace VeraCrypt
|
||||
l.push_back (shared_ptr <Hash> (new Sha256 ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
l.push_back (shared_ptr <Hash> (new Blake2s ()));
|
||||
l.push_back (shared_ptr <Hash> (new Whirlpool ()));
|
||||
l.push_back (shared_ptr <Hash> (new Whirlpool ()));
|
||||
l.push_back (shared_ptr <Hash> (new Streebog ()));
|
||||
#endif
|
||||
return l;
|
||||
@@ -46,7 +46,7 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
// RIPEMD-160
|
||||
// BLAKE2s
|
||||
Blake2s::Blake2s ()
|
||||
{
|
||||
Context.Allocate (sizeof (blake2s_state), 32);
|
||||
@@ -69,6 +69,30 @@ namespace VeraCrypt
|
||||
if_debug (ValidateDataParameters (data));
|
||||
blake2s_update ((blake2s_state *) Context.Ptr(), data.Get(), data.Size());
|
||||
}
|
||||
|
||||
// BLAKE2b
|
||||
Blake2b::Blake2b ()
|
||||
{
|
||||
Context.Allocate (sizeof (blake2b_state), 32);
|
||||
Init();
|
||||
}
|
||||
|
||||
void Blake2b::GetDigest (const BufferPtr &buffer)
|
||||
{
|
||||
if_debug (ValidateDigestParameters (buffer));
|
||||
blake2b_final ((blake2b_state *) Context.Ptr(), buffer, BLAKE2B_OUTBYTES);
|
||||
}
|
||||
|
||||
void Blake2b::Init ()
|
||||
{
|
||||
blake2b_init ((blake2b_state *) Context.Ptr(), BLAKE2B_OUTBYTES);
|
||||
}
|
||||
|
||||
void Blake2b::ProcessData (const ConstBufferPtr &data)
|
||||
{
|
||||
if_debug (ValidateDataParameters (data));
|
||||
blake2b_update ((blake2b_state *) Context.Ptr(), data.Get(), data.Size());
|
||||
}
|
||||
#endif
|
||||
|
||||
// SHA-256
|
||||
|
||||
Reference in New Issue
Block a user