Update TOTP-algorithm/Rust-TOTP-algorithm.md
parent
442e55c980
commit
56bfe5ba80
|
@ -1,6 +1,7 @@
|
||||||
# Implementation of the TOTP algorithm in Rust
|
# Implementation of the TOTP algorithm in Rust
|
||||||
|
|
||||||
```Rust
|
```Rust
|
||||||
|
// src/main.rs
|
||||||
use base32::decode;
|
use base32::decode;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use sha1::{digest::Update, Digest, Sha1};
|
use sha1::{digest::Update, Digest, Sha1};
|
||||||
|
@ -44,5 +45,14 @@ fn generate() {
|
||||||
|
|
||||||
println!("{:06}", token);
|
println!("{:06}", token);
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[package]
|
||||||
|
...
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
base32 = "0.4.0"
|
||||||
|
chrono = "0.4.33"
|
||||||
|
sha1 = "0.10.6"
|
||||||
```
|
```
|
Loading…
Reference in New Issue