summaryrefslogtreecommitdiffstats
path: root/TwoStepsAuthenticator.DotnetCore/Authenticator.cs
diff options
context:
space:
mode:
authorGuillaume Lacasa <glacasa@users.noreply.github.com>2016-08-28 20:33:12 +0200
committerGitHub <noreply@github.com>2016-08-28 20:33:12 +0200
commite3dca72a31aa4b31c94b0d23000529f4d52f8d2e (patch)
tree2df87b94c9c2487f1c9ff7cdf466805be50fa285 /TwoStepsAuthenticator.DotnetCore/Authenticator.cs
parentd788b7889c728f10c8a1aa6270f11c661815a6a3 (diff)
parentc9c0d238f70de62380aa3f02163418661eceed1a (diff)
downloadTwoStepsAuthenticator-master.zip
TwoStepsAuthenticator-master.tar.gz
TwoStepsAuthenticator-master.tar.bz2
Merge pull request #13 from LouisMT/fix-key-lengthHEADorigin/masterorigin/HEADmaster
Allow adjustment of key length
Diffstat (limited to 'TwoStepsAuthenticator.DotnetCore/Authenticator.cs')
-rw-r--r--TwoStepsAuthenticator.DotnetCore/Authenticator.cs5
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)];
}