Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Generate TOTP using Base32 Secret (6 Digits, Time-based, 30-second period)Generates a 6-digit time-based TOTP code using a base32 secret with a 30-second time period.
integer li_rc oleobject loo_Crypt string ls_SecretKey oleobject loo_SbKey integer li_Success integer li_NumRemoved integer li_NumDigits integer li_TimePeriod // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") if li_rc < 0 then destroy loo_Crypt MessageBox("Error","Connecting to COM object failed") return end if // Base32 secret key: ls_SecretKey = "oebf ytfl qmzb p4xd 2ztf zyz4 hjrw 3uyo" loo_SbKey = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbKey.ConnectToNewObject("Chilkat.StringBuilder") li_Success = loo_SbKey.Append(ls_SecretKey) // Remove SPACE chars. li_NumRemoved = loo_SbKey.Replace(" ","") // Note: A new token is generated every 30 seconds. You must generate within the same 30 second interval to get the same result. // Generate 6 digits. li_NumDigits = 6 // 30 second time period. li_TimePeriod = 30 Write-Debug "Your token is: " + loo_Crypt.Totp(loo_SbKey.GetAsString(),"base32","0","",li_TimePeriod,li_NumDigits,-1,"sha1") destroy loo_Crypt destroy loo_SbKey |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.