mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Correct implementation of SHA512 with WinRT in KeepassLib
This commit is contained in:
@@ -270,11 +270,15 @@ namespace ModernKeePassLib.Cryptography.Hash
|
||||
Reset();
|
||||
}
|
||||
|
||||
internal byte[] ComputeHash(byte[] pbOutBuffer)
|
||||
internal byte[] ComputeHash(byte[] value)
|
||||
{
|
||||
byte[] result = new byte[pbOutBuffer.Length];
|
||||
DoFinal(result, 0);
|
||||
return result;
|
||||
if (value == null) throw new ArgumentNullException(nameof(value));
|
||||
|
||||
byte[] resBuf = new byte[m_cbHashLength];
|
||||
BlockUpdate(value, 0, value.Length);
|
||||
DoFinal(resBuf, 0);
|
||||
|
||||
return resBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public abstract class DigestManaged : IDisposable
|
||||
{
|
||||
protected IDigest _hash;
|
||||
|
||||
public byte[] ComputeHash(byte[] value, int offset, int length)
|
||||
{
|
||||
if (value == null) throw new ArgumentNullException(nameof(value));
|
||||
|
||||
byte[] resBuf = new byte[_hash.GetDigestSize()];
|
||||
_hash.BlockUpdate(value, offset, length);
|
||||
_hash.DoFinal(resBuf, 0);
|
||||
|
||||
return resBuf;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_hash.Reset();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using Org.BouncyCastle.Crypto.Digests;
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public class SHA256Managed : DigestManaged
|
||||
{
|
||||
public SHA256Managed()
|
||||
{
|
||||
_hash = new Sha256Digest();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using Org.BouncyCastle.Crypto.Digests;
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public class SHA512Managed : DigestManaged
|
||||
{
|
||||
public SHA512Managed()
|
||||
{
|
||||
_hash = new Sha512Digest();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user