Replace sha1 dependency with sha-1

This other crate is being maintained, and it offers better performances
when using the `asm` feature (especially [on
AArch64](https://github.com/RustCrypto/hashes/pull/97)).
This commit is contained in:
Emmanuel Gil Peyrot 2020-01-06 12:09:31 +01:00
parent 44e65fcaf9
commit a7c13e28c7
2 changed files with 5 additions and 4 deletions

View File

@ -74,7 +74,7 @@ rand = "0.7"
regex = "1.3" regex = "1.3"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
sha1 = "0.6" sha-1 = "0.8"
slab = "0.4" slab = "0.4"
serde_urlencoded = "0.6.1" serde_urlencoded = "0.6.1"
time = "0.1.42" time = "0.1.42"

View File

@ -207,12 +207,13 @@ static WS_GUID: &str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
// TODO: hash is always same size, we dont need String // TODO: hash is always same size, we dont need String
pub fn hash_key(key: &[u8]) -> String { pub fn hash_key(key: &[u8]) -> String {
use sha1::Digest;
let mut hasher = sha1::Sha1::new(); let mut hasher = sha1::Sha1::new();
hasher.update(key); hasher.input(key);
hasher.update(WS_GUID.as_bytes()); hasher.input(WS_GUID.as_bytes());
base64::encode(&hasher.digest().bytes()) base64::encode(hasher.result().as_ref())
} }
#[cfg(test)] #[cfg(test)]