Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd93d3ec

Browse files
committed
Replace sha1 crate with sha-1
This other crate is being maintained, it offers better performances(when using the `asm` feature, especially [onAArch64](RustCrypto/hashes#97)). It also allowsdeduplicating SHA-1 crates in cargo-web.
1 parente9a3c9c commitd93d3ec

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

‎websocket-base/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ byteorder = "1.0"
2020
rand ="0.6.1"
2121
bitflags ="1.0.4"
2222
base64 ="0.10.0"
23-
sha1 ="0.6"
23+
sha-1 ="0.8"
2424
bytes = {version ="0.4",optional =true }
2525
futures = {version ="0.1",optional =true }
2626
native-tls = {version ="0.2.1",optional =true }

‎websocket-base/src/header.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod names {
1212

1313
externcrate base64;
1414
externcrate sha1;
15-
useself::sha1::Sha1;
15+
use sha1::{Digest,Sha1};
1616

1717
usecrate::result::{WebSocketError,WebSocketResult};
1818
use std::fmt::{self,Debug};
@@ -105,10 +105,8 @@ impl WebSocketAccept {
105105
letmut concat_key =String::with_capacity(serialized.len() +36);
106106
concat_key.push_str(&serialized[..]);
107107
concat_key.push_str(MAGIC_GUID);
108-
letmut sha1 =Sha1::new();
109-
sha1.update(concat_key.as_bytes());
110-
let bytes = sha1.digest().bytes();
111-
WebSocketAccept(bytes)
108+
let hash =Sha1::digest(concat_key.as_bytes());
109+
WebSocketAccept(hash.into())
112110
}
113111
/// Return the Base64 encoding of this WebSocketAccept
114112
pubfnserialize(&self) ->String{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp