Skip to content

Commit 3b1a0e4

Browse files
ryanbrandenburgmkArtakMSFT
authored andcommitted
Fix algos
1 parent a47139f commit 3b1a0e4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,18 @@ private async Task<string> GetShaIntegrity(ScriptTag scriptTag)
5050
var isSha256 = scriptTag.Integrity.StartsWith("sha256");
5151
var prefix = isSha256 ? "sha256" : "sha384";
5252
using (var respStream = await _httpClient.GetStreamAsync(scriptTag.Src))
53-
using (var alg = isSha256 ? SHA256.Create() : SHA384.Create())
53+
using (var alg256 = SHA256.Create())
54+
using (var alg384 = SHA384.Create())
5455
{
55-
var hash = alg.ComputeHash(respStream);
56+
string hash;
57+
if(isSha256)
58+
{
59+
hash = alg256.ComputeHash(respStream);
60+
}
61+
else
62+
{
63+
hash = alg384.ComputeHash(respStream);
64+
}
5665
return $"{prefix}-" + Convert.ToBase64String(hash);
5766
}
5867
}

0 commit comments

Comments
 (0)