summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Matthijssen <louis@u5r.nl>2016-08-25 16:56:57 +0200
committerLouis Matthijssen <louis@u5r.nl>2016-08-25 16:56:57 +0200
commitc9c0d238f70de62380aa3f02163418661eceed1a (patch)
tree2df87b94c9c2487f1c9ff7cdf466805be50fa285
parentd788b7889c728f10c8a1aa6270f11c661815a6a3 (diff)
downloadTwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.zip
TwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.tar.gz
TwoStepsAuthenticator-c9c0d238f70de62380aa3f02163418661eceed1a.tar.bz2
Allow adjustment of key length
-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)];
}