Sample code for 30+ languages & platforms
AutoIt

Generate TOTP using Base32 Secret (6 Digits, Time-based, 30-second period)

See more Encryption Examples

Generates a 6-digit time-based TOTP code using a base32 secret with a 30-second time period.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
; 
$oCrypt = ObjCreate("Chilkat.Crypt2")

; Base32 secret key:
Local $secretKey = "oebf ytfl qmzb p4xd 2ztf zyz4 hjrw 3uyo"

$oSbKey = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oSbKey.Append($secretKey)

; Remove SPACE chars.
Local $iNumRemoved = $oSbKey.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.
Local $iNumDigits = 6
; 30 second time period.
Local $iTimePeriod = 30
ConsoleWrite("Your token is: " & $oCrypt.Totp($oSbKey.GetAsString(),"base32","0","",$iTimePeriod,$iNumDigits,-1,"sha1") & @CRLF)