File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/Identity/test/Identity.Test Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,18 @@ private async Task<string> GetShaIntegrity(ScriptTag scriptTag)
50
50
var isSha256 = scriptTag . Integrity . StartsWith ( "sha256" ) ;
51
51
var prefix = isSha256 ? "sha256" : "sha384" ;
52
52
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 ( ) )
54
55
{
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
+ }
56
65
return $ "{ prefix } -" + Convert . ToBase64String ( hash ) ;
57
66
}
58
67
}
You can’t perform that action at this time.
0 commit comments