VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume/Hash.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2022-03-07 00:45:30 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2022-03-08 00:29:26 +0100
commit36795a688fd1d5bb9f497970938d9fcb08cfc330 (patch)
tree24ffb2320c1f72c16b96c13fa4dddda4267065ee /src/Volume/Hash.cpp
parent2dee49d3c8422aa1aa11c8630823aab3028cccd5 (diff)
downloadVeraCrypt-36795a688fd1d5bb9f497970938d9fcb08cfc330.tar.gz
VeraCrypt-36795a688fd1d5bb9f497970938d9fcb08cfc330.zip
Implement support of Blake2s-256 hash algorithm and remove deprecated algorithms RIPEMD-160 and GOST89.
Diffstat (limited to 'src/Volume/Hash.cpp')
-rw-r--r--src/Volume/Hash.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/Volume/Hash.cpp b/src/Volume/Hash.cpp
index 3925dde6..aad900c1 100644
--- a/src/Volume/Hash.cpp
+++ b/src/Volume/Hash.cpp
@@ -12,7 +12,7 @@
#include "Hash.h"
-#include "Crypto/Rmd160.h"
+#include "Crypto/blake2.h"
#include "Crypto/Sha2.h"
#include "Crypto/Whirlpool.h"
#include "Crypto/Streebog.h"
@@ -25,9 +25,9 @@ namespace VeraCrypt
l.push_back (shared_ptr <Hash> (new Sha512 ()));
l.push_back (shared_ptr <Hash> (new Whirlpool ()));
+ l.push_back (shared_ptr <Hash> (new Blake2s ()));
l.push_back (shared_ptr <Hash> (new Sha256 ()));
l.push_back (shared_ptr <Hash> (new Streebog ()));
- l.push_back (shared_ptr <Hash> (new Ripemd160 ()));
return l;
}
@@ -45,28 +45,27 @@ namespace VeraCrypt
}
// RIPEMD-160
- Ripemd160::Ripemd160 ()
+ Blake2s::Blake2s ()
{
- Deprecated = true; // Mark RIPEMD-160 as deprecated like on Windows.
- Context.Allocate (sizeof (RMD160_CTX), 32);
+ Context.Allocate (sizeof (blake2s_state), 32);
Init();
}
- void Ripemd160::GetDigest (const BufferPtr &buffer)
+ void Blake2s::GetDigest (const BufferPtr &buffer)
{
if_debug (ValidateDigestParameters (buffer));
- RMD160Final (buffer, (RMD160_CTX *) Context.Ptr());
+ blake2s_final ((blake2s_state *) Context.Ptr(), buffer);
}
- void Ripemd160::Init ()
+ void Blake2s::Init ()
{
- RMD160Init ((RMD160_CTX *) Context.Ptr());
+ blake2s_init ((blake2s_state *) Context.Ptr());
}
- void Ripemd160::ProcessData (const ConstBufferPtr &data)
+ void Blake2s::ProcessData (const ConstBufferPtr &data)
{
if_debug (ValidateDataParameters (data));
- RMD160Update ((RMD160_CTX *) Context.Ptr(), data.Get(), (int) data.Size());
+ blake2s_update ((blake2s_state *) Context.Ptr(), data.Get(), data.Size());
}
// SHA-256