From 8567014a48a992e933f0d45ff70e0495801ccb3e Mon Sep 17 00:00:00 2001 From: Slavasil Date: Thu, 4 Dec 2025 22:45:34 +0300 Subject: [PATCH] change hash function to SHA512 --- src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs | 4 ++-- src/KeyKeeper/PasswordStore/FileFormatConstants.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs b/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs index 30efa6d..b55e7f0 100644 --- a/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs +++ b/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs @@ -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(outerKey, 0); hasher.TransformFinalBlock(innerHash, 0, innerHash.Length); diff --git a/src/KeyKeeper/PasswordStore/FileFormatConstants.cs b/src/KeyKeeper/PasswordStore/FileFormatConstants.cs index 761f5a0..994cfb8 100644 --- a/src/KeyKeeper/PasswordStore/FileFormatConstants.cs +++ b/src/KeyKeeper/PasswordStore/FileFormatConstants.cs @@ -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;