oath 0.1.1

An pure Rust implementation of OATH algorithms. Currently provides HOTP and TOTP; OCRA is in progress.
docs.rs failed to build oath-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: oath-0.10.2

rust-oath Build Status

This library aims to provide implementations of HOTP, TOTP, and OCRA as specified by the RFCs.

Implemented:

Planned:

Examples

HOTP

// htop(key, counter, digits)
// hotp_raw takes bytes as the key
assert_eq!(hotp_raw(b"\xff", 23, 6), 330795);
// hotp takes a hex string as the key
assert_eq!(hotp("ff", 23, 6), 330795);

hotp_custom(b"\xff", 23, 6, Sha1::new());

TOTP

All the times below are in seconds.

// totp(key, digits, epoch, time_step)
totp("ff", 6, 0, 30); // defaults for most TOTP implementations
totp_raw(b"\xff", 6, 0, 30);
// totp_custom(key, digits, epoch, time_step, current_time, hash)
totp_custom(b"\xff", 6, 0, 30, 255, Sha1::new());