use external crate siphasher

Because std:#️⃣:SipHasher is deprecated.
This commit is contained in:
Dietmar Maurer 2018-12-28 19:50:07 +01:00
parent f0f3029e26
commit 46b6fbd6ae
2 changed files with 5 additions and 1 deletions

View File

@ -30,3 +30,5 @@ shellwords = "1.0.0"
uuid = { version = "0.7", features = ["v4"] } uuid = { version = "0.7", features = ["v4"] }
chrono = "0.4.6" # Date and time library for Rust chrono = "0.4.6" # Date and time library for Rust
openssl = "0.10.16" openssl = "0.10.16"
siphasher = "0.3"

View File

@ -16,6 +16,8 @@ use nix::sys::stat::Mode;
use nix::errno::Errno; use nix::errno::Errno;
use nix::sys::stat::FileStat; use nix::sys::stat::FileStat;
use siphasher::sip::SipHasher24;
const FILE_COPY_BUFFER_SIZE: usize = 1024*1024; const FILE_COPY_BUFFER_SIZE: usize = 1024*1024;
pub struct CaTarEncoder<W: Write> { pub struct CaTarEncoder<W: Write> {
@ -330,7 +332,7 @@ impl <W: Write> CaTarEncoder<W> {
fn compute_goodby_hash(name: &CStr) -> u64 { fn compute_goodby_hash(name: &CStr) -> u64 {
use std::hash::Hasher; use std::hash::Hasher;
let mut hasher = std::hash::SipHasher::new_with_keys(0x8574442b0f1d84b3, 0x2736ed30d1c22ec1); let mut hasher = SipHasher24::new_with_keys(0x8574442b0f1d84b3, 0x2736ed30d1c22ec1);
hasher.write(name.to_bytes()); hasher.write(name.to_bytes());
hasher.finish() hasher.finish()
} }