mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Go against Rider's wishes and not use var
This commit is contained in:
parent
a2b6908c07
commit
a903741276
1 changed files with 8 additions and 8 deletions
|
@ -51,27 +51,27 @@ namespace LBPUnion.ProjectLighthouse.Helpers {
|
|||
public static async Task<string> 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<byte>()
|
||||
: 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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue