diff --git a/Akari.Prototype.Server/Utils/Security.cs b/Akari.Prototype.Server/Utils/Security.cs index 9b427f4..0ff3440 100644 --- a/Akari.Prototype.Server/Utils/Security.cs +++ b/Akari.Prototype.Server/Utils/Security.cs @@ -87,7 +87,7 @@ namespace Akari.Prototype.Server.Utils // We write everything into one big array for easier encoding int encryptedDataLength = 4 + nonceSize + 4 + tagSize + cipherSize; - Span encryptedData = encryptedDataLength < 1024 + Span encryptedData = encryptedDataLength <= 1024 ? stackalloc byte[encryptedDataLength] : new byte[encryptedDataLength]; @@ -122,7 +122,7 @@ namespace Akari.Prototype.Server.Utils var cipherBytes = encryptedData.Slice(4 + nonceSize + 4 + tagSize, cipherSize); // Decrypt - Span plainBytes = cipherSize < 1024 + Span plainBytes = cipherSize <= 1024 ? stackalloc byte[cipherSize] : new byte[cipherSize];