diff options
author | Louis Matthijssen <louis@u5r.nl> | 2016-08-25 16:56:57 +0200 |
---|---|---|
committer | Louis Matthijssen <louis@u5r.nl> | 2016-08-25 16:56:57 +0200 |
commit | c9c0d238f70de62380aa3f02163418661eceed1a (patch) | |
tree | 2df87b94c9c2487f1c9ff7cdf466805be50fa285 /TwoStepsAuthenticator.DotnetCore/Authenticator.cs | |
parent | d788b7889c728f10c8a1aa6270f11c661815a6a3 (diff) | |
download | TwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.zip TwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.tar.gz TwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.tar.bz2 |
Allow adjustment of key length
Diffstat (limited to 'TwoStepsAuthenticator.DotnetCore/Authenticator.cs')
-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)]; } |