ModernKeePassLib implements HMAC correctly

Blake2b also implemented, but not tested
ModernKeePass app better implements focus on database password box (but still not working correctly)
This commit is contained in:
2017-10-26 12:38:34 +02:00
committed by BONNEVILLE Geoffroy
parent 5cf4ff3012
commit 1b439a4960
18 changed files with 317 additions and 213 deletions

View File

@@ -42,8 +42,6 @@ namespace ModernKeePassLib.Cryptography
private readonly Stream m_sBaseStream;
private readonly bool m_bWriting;
#if ModernKeePassLib
//private ICryptoTransform m_hash;
//private CryptographicHash m_hash;
private IDigest m_hash;
#else
private HashAlgorithm m_hash;
@@ -93,8 +91,6 @@ namespace ModernKeePassLib.Cryptography
m_sBaseStream = sBaseStream;
m_bWriting = bWriting;
#if ModernKeePassLib
//m_hash = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithm.Sha256).CreateHash();
//m_hash = HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithmNames.Sha256).CreateHash();
m_hash = hashAlgorithm ?? new Sha256Digest();
#elif !KeePassLibSD
m_hash = (hashAlgorithm ?? new SHA256Managed());
@@ -128,8 +124,6 @@ namespace ModernKeePassLib.Cryptography
try
{
#if ModernKeePassLib
//m_pbFinalHash = (m_hash as CryptographicHash).GetValueAndReset ();
//CryptographicBuffer.CopyToByteArray(m_hash.GetValueAndReset(), out m_pbFinalHash);
m_pbFinalHash = new byte[32];
m_hash.DoFinal(m_pbFinalHash, 0);
m_hash.Reset();