diff --git a/ProjectLighthouse/Helpers/HashHelper.cs b/ProjectLighthouse/Helpers/HashHelper.cs index 72c7724a..865a04f3 100644 --- a/ProjectLighthouse/Helpers/HashHelper.cs +++ b/ProjectLighthouse/Helpers/HashHelper.cs @@ -51,27 +51,27 @@ namespace LBPUnion.ProjectLighthouse.Helpers { public static async Task ComputeDigest(string path, string authCookie, Stream body, string digestKey) { - var memoryStream = new MemoryStream(); + MemoryStream memoryStream = new MemoryStream(); - var pathBytes = Encoding.UTF8.GetBytes(path); - var cookieBytes = string.IsNullOrEmpty(authCookie) + byte[] pathBytes = Encoding.UTF8.GetBytes(path); + byte[] cookieBytes = string.IsNullOrEmpty(authCookie) ? Array.Empty() : Encoding.UTF8.GetBytes(authCookie); - var keyBytes = Encoding.UTF8.GetBytes(digestKey); + byte[] keyBytes = Encoding.UTF8.GetBytes(digestKey); await body.CopyToAsync(memoryStream); - var bodyBytes = memoryStream.ToArray(); + byte[] bodyBytes = memoryStream.ToArray(); - using var sha1 = IncrementalHash.CreateHash(HashAlgorithmName.SHA1); + using IncrementalHash sha1 = IncrementalHash.CreateHash(HashAlgorithmName.SHA1); sha1.AppendData(bodyBytes); if (cookieBytes.Length > 0) sha1.AppendData(cookieBytes); sha1.AppendData(pathBytes); sha1.AppendData(keyBytes); - var digestBytes = sha1.GetHashAndReset(); - var digestString = Convert.ToHexString(digestBytes).ToLower(); + byte[] digestBytes = sha1.GetHashAndReset(); + string digestString = Convert.ToHexString(digestBytes).ToLower(); return digestString; }