change hash function to SHA512

This commit is contained in:
2025-12-04 22:45:34 +03:00
parent 33e31cb070
commit 8567014a48
2 changed files with 3 additions and 3 deletions

View File

@@ -129,7 +129,7 @@ public class PassStoreContentChunk
private static byte[] ComputeHmac(byte[] data, byte[] key, int chunkOrdinal)
{
SHA3_512 hasher = SHA3_512.Create();
SHA512 hasher = SHA512.Create();
byte[] innerKey = key.Select(x => (byte)(x ^ 0x36)).ToArray();
byte[] outerKey = key.Select(x => (byte)(x ^ 0x5c)).ToArray();
@@ -145,7 +145,7 @@ public class PassStoreContentChunk
byte[] innerHash = hasher.Hash!;
hasher.Clear();
hasher = SHA3_512.Create();
hasher = SHA512.Create();
hasher.TransformBlock(outerKey, 0, outerKey.Length, null, 0);
Array.Fill<byte>(outerKey, 0);
hasher.TransformFinalBlock(innerHash, 0, innerHash.Length);

View File

@@ -11,7 +11,7 @@ static class FileFormatConstants
public const int MAX_AESKDF_ROUNDS = AesKdf.MAX_ROUNDS;
public const byte ENCRYPT_ALGO_AES = 14;
public const byte KDF_TYPE_AESKDF = 195;
public const int HMAC_SIZE = HMACSHA3_512.HashSizeInBytes;
public const int HMAC_SIZE = SHA512.HashSizeInBytes;
public const uint FILE_FIELD_BEGIN = 0x7853dbd5;
public const uint FILE_FIELD_INNER_CRYPTO = 0x613e91e4;
public const uint FILE_FIELD_CONFIG = 0xd36a53c0;