From 6604ae292b8d5b2e69de1f6c079dd7330df37c83 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Sun, 26 Oct 2014 06:17:27 +0100 Subject: [PATCH] fixed a bug in TOTP calculation. see https://keepass2android.codeplex.com/workitem/279 (if Math.pow(10,6) returns 999 999.99999 this was converted to 999 999 in the previous version) --- src/keepass2android/Totp/Totp_Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keepass2android/Totp/Totp_Client.cs b/src/keepass2android/Totp/Totp_Client.cs index 27cdd07f..9ac5d8cc 100644 --- a/src/keepass2android/Totp/Totp_Client.cs +++ b/src/keepass2android/Totp/Totp_Client.cs @@ -114,7 +114,7 @@ namespace OtpProviderClient | ((hash[offset + 2] & 0xff) << 8) //Math. | (hash[offset + 3] & 0xff); //Math. - int password = binary % (int)Math.Pow(10, _Length); //Math. + int password = binary % Convert.ToInt32(Math.Pow(10, _Length)); //Math. return password.ToString(new string('0', _Length)); //Math. } }