Skip to content

Commit

Permalink
Replaced RNGCryptoServiceProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Killeroo committed Jun 27, 2023
1 parent c4c81b4 commit ff07ff6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Utils/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,9 @@ public static bool IsBetween(long value, long left, long right)
/// <returns></returns>
public static String RandomString(int len = 11)
{
string result;

using (RandomNumberGenerator rng = new RNGCryptoServiceProvider())
{
byte[] rngToken = new byte[len + 1];
rng.GetBytes(rngToken);

result = Convert.ToBase64String(rngToken);
}
RandomNumberGenerator.Create();
byte[] randomBytes = RandomNumberGenerator.GetBytes(len);
string result = Convert.ToBase64String(randomBytes);

// Remove '=' from end of string
return result.Remove(result.Length - 1);
Expand Down

0 comments on commit ff07ff6

Please sign in to comment.