doy / rbw

unofficial bitwarden cli
https://git.tozt.net/rbw
Other
649 stars 87 forks source link

Zero-pad auth code #25

Closed tyilo closed 4 years ago

tyilo commented 4 years ago

oath::totp_raw_now doesn't zero-pad the result.

For example the following code outputs 3406 instead of 003406:

extern crate oath;

use oath::{totp_raw_custom_time, HashType};

fn main () {
    let res = totp_raw_custom_time(b"12345678901234567890", 6, 0, 30, 26*365*24*60*60, &HashType::SHA1);
    println!("{}", res);
}
doy commented 4 years ago

thanks!