mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Added more tests
Code cleanup in Lib WIP new VM for OpendatabaseControl WIP KDBX4 file save - still not working
This commit is contained in:

committed by
BONNEVILLE Geoffroy

parent
278b2759d5
commit
53a54252e3
@@ -40,9 +40,13 @@ namespace ModernKeePassLib.Cryptography.Hash
|
||||
Buffer.BlockCopy(inputBuffer, inputOffset, outputBuffer, outputOffset, inputCount);
|
||||
}
|
||||
|
||||
public void TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
Hmac.BlockUpdate(inputBuffer, inputOffset, inputCount);
|
||||
byte[] outputBytes = new byte[inputCount];
|
||||
if (inputCount != 0)
|
||||
Buffer.BlockCopy(inputBuffer, inputOffset, outputBytes, 0, inputCount);
|
||||
return outputBytes;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
@@ -3,7 +3,7 @@ using Org.BouncyCastle.Crypto;
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public abstract class DigestManaged: IDisposable
|
||||
public abstract class HashAlgorithm: IDisposable
|
||||
{
|
||||
protected IDigest Digest;
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace ModernKeePassLib.Cryptography.Hash
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanReuseTransform => true;
|
||||
public bool CanTransformMultipleBlocks => true;
|
||||
|
||||
public byte[] ComputeHash(byte[] value)
|
||||
{
|
||||
return ComputeHash(value, 0, value.Length);
|
||||
@@ -41,9 +44,13 @@ namespace ModernKeePassLib.Cryptography.Hash
|
||||
Buffer.BlockCopy(inputBuffer, inputOffset, outputBuffer, outputOffset, inputCount);
|
||||
}
|
||||
|
||||
public void TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
Digest.BlockUpdate(inputBuffer, inputOffset, inputCount);
|
||||
byte[] outputBytes = new byte[inputCount];
|
||||
if (inputCount != 0)
|
||||
Buffer.BlockCopy(inputBuffer, inputOffset, outputBytes, 0, inputCount);
|
||||
return outputBytes;
|
||||
}
|
||||
|
||||
public void Dispose()
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public class SHA256Managed : DigestManaged
|
||||
public class SHA256Managed : HashAlgorithm
|
||||
{
|
||||
public SHA256Managed()
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace ModernKeePassLib.Cryptography.Hash
|
||||
{
|
||||
public class SHA512Managed: DigestManaged
|
||||
public class SHA512Managed: HashAlgorithm
|
||||
{
|
||||
public SHA512Managed()
|
||||
{
|
||||
|
Reference in New Issue
Block a user