diff options
-rw-r--r-- | TwoStepsAuthenticator/TwoStepsAuthenticator.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/TwoStepsAuthenticator/TwoStepsAuthenticator.cs b/TwoStepsAuthenticator/TwoStepsAuthenticator.cs index d35feb7..5cd599c 100644 --- a/TwoStepsAuthenticator/TwoStepsAuthenticator.cs +++ b/TwoStepsAuthenticator/TwoStepsAuthenticator.cs @@ -14,18 +14,18 @@ namespace TwoStepsAuthenticator //private static final int INTERVAL = 30; HMACSHA1 mac; - public void GetPinCode(string key, DateTime date) + public void GetPinCode(string secret, DateTime date) { TimeSpan ts = (date.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)); var interval = (long)ts.TotalSeconds / 30; var challengeBytes = BitConverter.GetBytes(interval); - // OK jusque là - - mac = new HMACSHA1(Base32Encoding.ToBytes(key)); - + var key = Base32Encoding.ToBytes(secret); + // OK jusque là + mac = new HMACSHA1(key); + var hash = mac.ComputeHash(challengeBytes); //var hash = mac.TransformFinalBlock(challengeBytes); //int offset = hash[hash.Length - 1] & 0xF; |