brackets-curlyUsage

using OTPLib;

TOTP

// Default: SHA1

string secretkey = "ADII2YLBLAAE5DLV36M7ZXXFIJT64753ZR3CSSWWVTRJE7WEWSDG3YVCKGYHSWL45SIJYRLX25UILRBFRTW35GUHJUBHCQXLWXEHG2I=";
TOTP totp = new TOTP(30, 6);
//TOTP totp = new TOTP(30, 6, OTPHashAlgorithm.SHA1);
string otpcode = totp.GenerateOTP(secretkey);
int timeleft = totp.GetRemainingTime();

Console.WriteLine("OTP code: {0}\r\nTimeleft: {1}", otpcode, timeleft.ToString());

HOTP

// Default: SHA1

string secretkey = "JVDSOVL2IZVGSWB4H5XG6WKGON7G4W2TLNKW27JL";
HOTP hotp = new HOTP(1000, 8, OTPHashAlgorithm.SHA1);
string otpcode = hotp.GenerateOTP(secretkey);

Static Functions

Last updated