Function oath::hotp_raw [] [src]

pub fn hotp_raw(key: &[u8], counter: u64, digits: u32) -> u64

Computes an one-time password using HOTP algorithm. Same as hotp, but expects key to be a &[u8].

key is a slice, that represents the shared secret;

counter is a counter. Due to RFC4226 it MUST be synchronized between the HOTP generator (client) and the HOTP validator (server);

digits - number of digits in output (usually 6 or 8);

Example

extern crate oath;

use oath::hotp_raw;

fn main () {
    assert_eq!(hotp_raw(b"\xff", 23, 6), 330795);
}