diff options
author | Guillaume Lacasa <glacasa@users.noreply.github.com> | 2016-08-28 20:33:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-28 20:33:12 +0200 |
commit | e3dca72a31aa4b31c94b0d23000529f4d52f8d2e (patch) | |
tree | 2df87b94c9c2487f1c9ff7cdf466805be50fa285 | |
parent | d788b7889c728f10c8a1aa6270f11c661815a6a3 (diff) | |
parent | c9c0d238f70de62380aa3f02163418661eceed1a (diff) | |
download | TwoStepsAuthenticator-origin/master.zip TwoStepsAuthenticator-origin/master.tar.gz TwoStepsAuthenticator-origin/master.tar.bz2 |
Merge pull request #13 from LouisMT/fix-key-lengthHEADorigin/masterorigin/HEADmaster
Allow adjustment of key length
-rw-r--r-- | TwoStepsAuthenticator.DotnetCore/Authenticator.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/TwoStepsAuthenticator.DotnetCore/Authenticator.cs b/TwoStepsAuthenticator.DotnetCore/Authenticator.cs index 95ce955..29eb84a 100644 --- a/TwoStepsAuthenticator.DotnetCore/Authenticator.cs +++ b/TwoStepsAuthenticator.DotnetCore/Authenticator.cs @@ -14,11 +14,10 @@ namespace TwoStepsAuthenticator #else private static readonly RNGCryptoServiceProvider Random = new RNGCryptoServiceProvider(); #endif - private static readonly int KeyLength = 16; private static readonly string AvailableKeyChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; - public static string GenerateKey() { - var keyChars = new char[KeyLength]; + public static string GenerateKey(int keyLength = 16) { + var keyChars = new char[keyLength]; for (int i = 0; i < keyChars.Length; i++) { keyChars[i] = AvailableKeyChars[RandomInt(AvailableKeyChars.Length)]; } |