public static void Main()
public static void GenarateTOTP()
var key = "UHVudG9zMTYwMzQwMDE1Mzk0NDcyNjA0MTUxODFEOUEtOTAyQy00NTA5LTg1ODQtMDUwMTI0OEJERDdBMjk0NDcyNjA0Q29sb21iaWE=";
Console.WriteLine(CodeCalculation(key));
private static Totp LoadTotp(string secretKey)
var base32Bytes = Convert.FromBase64String(secretKey);
return new Totp(base32Bytes, step: 60, totpSize: 4);
public static string CodeCalculation(string secretKey)
var totp = LoadTotp(secretKey);
var stringDate = "2020-10-24 14:05:00";
var dateTime = DateTime.Parse(stringDate).AddHours(5);
Console.WriteLine(dateTime);
return totp.ComputeTotp(dateTime);