Leancrypto 0.12.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
One-Time Pad Algorithms

Functions

void lc_hotp (const uint8_t *hmac_key, size_t hmac_key_len, uint64_t counter, uint32_t digits, uint32_t *hotp_val)
 HMAC-Based One-Time Password Algorithm - RFC 4226.
 
int lc_totp (const uint8_t *hmac_key, size_t hmac_key_len, uint32_t step, uint32_t digits, uint32_t *totp_val)
 Time-Based One-Time Password Algorithm - RFC 6238.
 

Detailed Description

Function Documentation

◆ lc_hotp()

void lc_hotp ( const uint8_t * hmac_key,
size_t hmac_key_len,
uint64_t counter,
uint32_t digits,
uint32_t * hotp_val )

HMAC-Based One-Time Password Algorithm - RFC 4226.

The HOTP algorithm uses HMAC SHA-256

Parameters
[in]hmac_keySeed key / HMAC key K - shared secret between client and server; each HOTP generator has a different and unique secret K.
[in]hmac_key_lenSeed key / HMAC key length
[in]counterCounter C - 8-byte counter value, the moving factor. This counter MUST be synchronized between the HOTP generator (client) and the HOTP validator (server).
[in]digitsnumber of digits in an HOTP value; system parameter.
[out]hotp_valHOTP output value

◆ lc_totp()

int lc_totp ( const uint8_t * hmac_key,
size_t hmac_key_len,
uint32_t step,
uint32_t digits,
uint32_t * totp_val )

Time-Based One-Time Password Algorithm - RFC 6238.

The TOTP algorithm uses HMAC SHA-256

Parameters
[in]hmac_keySeed key / HMAC key K - shared secret between client and server; each HOTP generator has a different and unique secret K.
[in]hmac_key_lenSeed key / HMAC key length
[in]stepTime step in seconds - to use the default value of 30 seconds, use 30
[in]digitsnumber of digits in a TOTP value; system parameter.
[out]totp_valTOTP output value