File tree 2 files changed +4
-6
lines changed
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ byteorder = "1.0"
20
20
rand = " 0.6.1"
21
21
bitflags = " 1.0.4"
22
22
base64 = " 0.10.0"
23
- sha1 = " 0.6 "
23
+ sha-1 = " 0.8 "
24
24
bytes = { version = " 0.4" , optional = true }
25
25
futures = { version = " 0.1" , optional = true }
26
26
native-tls = { version = " 0.2.1" , optional = true }
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ pub mod names {
12
12
13
13
extern crate base64;
14
14
extern crate sha1;
15
- use self :: sha1:: Sha1 ;
15
+ use sha1:: { Digest , Sha1 } ;
16
16
17
17
use crate :: result:: { WebSocketError , WebSocketResult } ;
18
18
use std:: fmt:: { self , Debug } ;
@@ -105,10 +105,8 @@ impl WebSocketAccept {
105
105
let mut concat_key = String :: with_capacity ( serialized. len ( ) + 36 ) ;
106
106
concat_key. push_str ( & serialized[ ..] ) ;
107
107
concat_key. push_str ( MAGIC_GUID ) ;
108
- let mut 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 ( ) )
112
110
}
113
111
/// Return the Base64 encoding of this WebSocketAccept
114
112
pub fn serialize ( & self ) -> String {
You can’t perform that action at this time.
0 commit comments