File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -231,31 +231,31 @@ impl Default for SipState {
231
231
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
232
232
#[ deriving( Clone ) ]
233
233
pub struct SipHasher {
234
- priv state : SipState ,
234
+ priv k0: u64 ,
235
+ priv k1: u64 ,
235
236
}
236
237
237
238
impl SipHasher {
238
239
/// Create a `Sip`.
239
240
#[ inline]
240
241
pub fn new ( ) -> SipHasher {
241
- SipHasher {
242
- state : SipState :: new ( ) ,
243
- }
242
+ SipHasher :: new_with_keys ( 0 , 0 )
244
243
}
245
244
246
245
/// Create a `Sip` that is keyed off the provided keys.
247
246
#[ inline]
248
247
pub fn new_with_keys ( key0 : u64 , key1 : u64 ) -> SipHasher {
249
248
SipHasher {
250
- state : SipState :: new_with_keys ( key0, key1) ,
249
+ k0 : key0,
250
+ k1 : key1,
251
251
}
252
252
}
253
253
}
254
254
255
255
impl Hasher < SipState > for SipHasher {
256
256
#[ inline]
257
257
fn hash < T : Hash < SipState > > ( & self , value : & T ) -> u64 {
258
- let mut state = self . state . clone ( ) ;
258
+ let mut state = SipState :: new_with_keys ( self . k0 , self . k1 ) ;
259
259
value. hash ( & mut state) ;
260
260
state. result ( )
261
261
}
You can’t perform that action at this time.
0 commit comments