Method __builtin.Nettle.Hash()->hotp()
- Method
hotp
inthotp(string(8bit)secret,intfactor,int(1..)|voidlength)- Description
HMAC-Based One-Time Password as defined by RFC 4226.
Can be used to implement the RFC 6238 Time-Based One-Time Password Algorithm by giving the factor
(time()-T0)/X. Specifically for Google Authenticator this isCrypto.SHA1.hotp(secret,time()/30), using an 80 bit secret.- Parameter
secret A shared secret between both parties. Typically the same size as the hash output.
- Parameter
factor A moving factor. Defined in RFC 4226 to be a counter synchronized between both parties.
- Parameter
length The maximum number of digits of the one-time password. Defaults to 6. Note that the result is usually 0-padded to this length for user display purposes.