mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-25 23:09:22 +00:00
Update sha1
This commit is contained in:
parent
a16bbc3249
commit
ae546b2d3e
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -588,6 +588,15 @@ dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-modes"
|
||||
version = "0.7.0"
|
||||
@ -806,7 +815,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha1 0.10.1",
|
||||
"tokio 0.2.25",
|
||||
"url",
|
||||
"webauthn-rs",
|
||||
@ -944,6 +953,16 @@ dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curl"
|
||||
version = "0.4.42"
|
||||
@ -1045,6 +1064,16 @@ dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.2",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "discard"
|
||||
version = "1.0.4"
|
||||
@ -2070,7 +2099,7 @@ dependencies = [
|
||||
"rust_decimal",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha1 0.6.1",
|
||||
"sha2 0.8.2",
|
||||
"time 0.2.27",
|
||||
"twox-hash",
|
||||
@ -2965,6 +2994,17 @@ dependencies = [
|
||||
"sha1_smol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1_smol"
|
||||
version = "1.0.0"
|
||||
@ -3136,7 +3176,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha1 0.6.1",
|
||||
"syn",
|
||||
]
|
||||
|
||||
|
@ -22,7 +22,7 @@ futures = "0.3.12"
|
||||
encoding_rs = "0.8.28"
|
||||
percent-encoding = "2.1.0"
|
||||
mailchecker = "4.0.3"
|
||||
sha1 = "0.6.0"
|
||||
sha1 = "0.10.1"
|
||||
rand = "0.8.3"
|
||||
chrono = "0.4.19"
|
||||
bytes = "1.0.1"
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
extern crate sha1;
|
||||
|
||||
use crate::data::error::{ResultBoxError, ExecError};
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::{Rng, thread_rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use sha1::Digest;
|
||||
|
||||
use crate::data::error::{ExecError, ResultBoxError};
|
||||
|
||||
/// Generate a new sha1 string
|
||||
///
|
||||
@ -17,7 +19,10 @@ use rand::distributions::Alphanumeric;
|
||||
/// assert_eq!(res, "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4");
|
||||
/// ```
|
||||
pub fn sha1_str(input: &str) -> String {
|
||||
sha1::Sha1::from(input).digest().to_string()
|
||||
let mut hasher = sha1::Sha1::default();
|
||||
hasher.update(input.as_bytes());
|
||||
let result = hasher.finalize();
|
||||
format!("{:x}", result)
|
||||
}
|
||||
|
||||
/// One-way user password crypt
|
||||
|
Loading…
Reference in New Issue
Block a user