Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Haik committed Oct 30, 2023
1 parent 28403d7 commit c9b5a86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Pandatech.Crypto/Aes256.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class Aes256
private static readonly string Key = Environment.GetEnvironmentVariable("AES_KEY")!;
private const int KeySize = 256;
private const int IvSize = 16;
private const int HashSize = 64;

public static byte[] Encrypt(string plainText)
{
Expand Down Expand Up @@ -80,8 +81,7 @@ public static string DecryptIgnoringHash(byte[] cipherTextWithHash)

public static string DecryptIgnoringHash(byte[] cipherTextWithHash, string key)
{
const int hashSize = 64;
var cipherText = cipherTextWithHash.Take(cipherTextWithHash.Length - hashSize).ToArray();
var cipherText = cipherTextWithHash.Take(cipherTextWithHash.Length - HashSize).ToArray();
return Decrypt(cipherText, key);
}

Expand Down

0 comments on commit c9b5a86

Please sign in to comment.