GoEasy-OTP > Python生成GoEasy-OTP
 

GoEasy-OTP - Python生成GoEasy-OTP

Python

from Crypto.Cipher import AES

def goEasyOTP(secretKey):
    otp = "000" + str(int(round(time.time() * 1000)))
    cipher = AES.new(secretKey, AES.MODE_ECB)
    encryptedOtp = cipher.encrypt(otp)
    encryptedOtp = base64.b64encode(encryptedOtp)
    return encryptedOtp

验证OTP生成结果

测试参数:

secret key:86726e4356dce2d3

系统毫秒数:0001490325990593

测试结果:

GoEasy-otp:+rOKqbTZioistsdMrhon0A==

相关链接:

什么是GoEasy-OTP?
如何使用GoEasy-OTP?
验证GoEasy-OTP生成结果
Java生成GoEasy-OTP
PHP生成GoEasy-OTP
Python生成GoEasy-OTP
Ruby生成GoEasy-OTP
C#生成GoEasy-OTP

results matching ""

    No results matching ""