Skip to content

Commit

Permalink
Merge pull request snapview#30 from mehcode/feature/sha1-to-sha-1
Browse files Browse the repository at this point in the history
Switch from sha1 to sha-1
  • Loading branch information
daniel-abramov committed Jun 26, 2018
2 parents 1c57f0f + fbdd412 commit e1e0acd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -24,7 +24,7 @@ httparse = "1.3.1"
input_buffer = { git = "https://github.com/snapview/input_buffer" }
log = "0.4.2"
rand = "0.5.2"
sha1 = "0.4.0"
sha-1 = "0.7"
url = "1.7.0"
utf-8 = "0.7.2"

Expand Down
10 changes: 5 additions & 5 deletions src/handshake/mod.rs
Expand Up @@ -11,7 +11,7 @@ use std::fmt;
use std::io::{Read, Write};

use base64;
use sha1::Sha1;
use sha1::{Sha1, Digest};

use error::Error;
use self::machine::{HandshakeMachine, RoundResult, StageResult, TryParse};
Expand Down Expand Up @@ -111,10 +111,10 @@ fn convert_key(input: &[u8]) -> Result<String, Error> {
// ... field is constructed by concatenating /key/ ...
// ... with the string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" (RFC 6455)
const WS_GUID: &'static [u8] = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
let mut sha1 = Sha1::new();
sha1.update(input);
sha1.update(WS_GUID);
Ok(base64::encode(&sha1.digest().bytes()))
let mut sha1 = Sha1::default();
sha1.input(input);
sha1.input(WS_GUID);
Ok(base64::encode(&sha1.result()))
}

#[cfg(test)]
Expand Down

0 comments on commit e1e0acd

Please sign in to comment.