From 9bb81d8160dc1c16753fdae4a42c1d4746578560 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Fri, 25 Dec 2020 10:28:38 +0100 Subject: [PATCH] chore: Update sha-1 to 0.9 Signed-off-by: Igor Raits --- Cargo.toml | 2 +- src/handshake.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8da2312..fc8f19e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ log = "0.4.1" mio = "0.6.14" mio-extras = "2.0" rand = "0.7" -sha-1 = "0.8.0" +sha-1 = "0.9" slab = "0.4" url = "2.0.0" diff --git a/src/handshake.rs b/src/handshake.rs index b7520bd..7d5ca23 100644 --- a/src/handshake.rs +++ b/src/handshake.rs @@ -22,10 +22,10 @@ fn generate_key() -> String { pub fn hash_key(key: &[u8]) -> String { let mut hasher = sha1::Sha1::new(); - hasher.input(key); - hasher.input(WS_GUID.as_bytes()); + hasher.update(key); + hasher.update(WS_GUID.as_bytes()); - encode_base64(&hasher.result()) + encode_base64(&hasher.finalize()) } // This code is based on rustc_serialize base64 STANDARD