Function oath::totp_raw_custom_time
[−]
[src]
pub fn totp_raw_custom_time(
key: &[u8],
digits: u32,
epoch: u64,
time_step: u64,
timestamp: u64,
hash: &HashType
) -> u64
Computes an one-time password using TOTP algorithm for arbitrary timestamp.
Same as totp_custom_time
, but expects key to be a &[u8]
.
key
is a slice, that represents the shared secret;
digits
- number of digits in output (usually 6 or 8);
epoch
- initial counter time T0 (default value is 0);
time_step
- time step in seconds (default value is 30);
timestamp
- moment of time to be computed (in seconds);
Example
extern crate oath; use oath::{totp_raw_custom_time, HashType}; fn main () { totp_raw_custom_time(b"12345678901234567890", 6, 0, 30, 26*365*24*60*60, &HashType::SHA1); }