From a903741276682d50860ccd599a8205d2aeab4394 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Sun, 31 Oct 2021 13:47:50 -0400 Subject: [PATCH] Go against Rider's wishes and not use var --- ProjectLighthouse/Helpers/HashHelper.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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; }