mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Integrate SHA-256 support into Linux/MacOSX code. Set PRF priority to SHA-512 -> Whirlpool -> SHA-256 -> RIPEMD-160 .
This commit is contained in:
@@ -17,10 +17,11 @@ namespace VeraCrypt
|
||||
HashList Hash::GetAvailableAlgorithms ()
|
||||
{
|
||||
HashList l;
|
||||
|
||||
l.push_back (shared_ptr <Hash> (new Ripemd160 ()));
|
||||
|
||||
l.push_back (shared_ptr <Hash> (new Sha512 ()));
|
||||
l.push_back (shared_ptr <Hash> (new Whirlpool ()));
|
||||
l.push_back (shared_ptr <Hash> (new Sha256 ()));
|
||||
l.push_back (shared_ptr <Hash> (new Ripemd160 ()));
|
||||
|
||||
return l;
|
||||
}
|
||||
@@ -60,6 +61,30 @@ namespace VeraCrypt
|
||||
if_debug (ValidateDataParameters (data));
|
||||
RMD160Update ((RMD160_CTX *) Context.Ptr(), data.Get(), (int) data.Size());
|
||||
}
|
||||
|
||||
// SHA-256
|
||||
Sha256::Sha256 ()
|
||||
{
|
||||
Context.Allocate (sizeof (sha256_ctx));
|
||||
Init();
|
||||
}
|
||||
|
||||
void Sha256::GetDigest (const BufferPtr &buffer)
|
||||
{
|
||||
if_debug (ValidateDigestParameters (buffer));
|
||||
sha256_end (buffer, (sha256_ctx *) Context.Ptr());
|
||||
}
|
||||
|
||||
void Sha256::Init ()
|
||||
{
|
||||
sha256_begin ((sha256_ctx *) Context.Ptr());
|
||||
}
|
||||
|
||||
void Sha256::ProcessData (const ConstBufferPtr &data)
|
||||
{
|
||||
if_debug (ValidateDataParameters (data));
|
||||
sha256_hash (data.Get(), (int) data.Size(), (sha256_ctx *) Context.Ptr());
|
||||
}
|
||||
|
||||
// SHA-512
|
||||
Sha512::Sha512 ()
|
||||
|
||||
Reference in New Issue
Block a user