Skip to content

Commit 025223d

Browse files
committed
Merge branch 'main' into develop
2 parents 20978f5 + 2cafd97 commit 025223d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "10.0.0",
3+
"version": "9.0.0",
44
"rollForward": "latestMajor",
55
"allowPrerelease": true
66
}

src/KSFramework/Utilities/SecurityHelper.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ public static class SecurityHelper
77
public static string GetSha256Hash(string input)
88
{
99
//using (var sha256 = new SHA256CryptoServiceProvider())
10-
using var sha256 = SHA256.Create();
1110
var byteValue = Encoding.UTF8.GetBytes(input);
12-
var byteHash = sha256.ComputeHash(byteValue);
11+
var byteHash = SHA256.HashData(byteValue);
1312
return Convert.ToBase64String(byteHash);
1413
//return BitConverter.ToString(byteHash).Replace("-", "").ToLower();
1514
}
1615

1716
public static string GenerateToken(int byteLength = 32)
1817
{
19-
var randomNumber = new byte[byteLength];
20-
using var rng = RandomNumberGenerator.Create();
21-
rng.GetBytes(randomNumber);
18+
Span<byte> randomNumber = stackalloc byte[byteLength];
19+
RandomNumberGenerator.Fill(randomNumber);
2220
return Convert.ToBase64String(randomNumber);
2321
}
2422
}

0 commit comments

Comments
 (0)