mirror of https://github.com/dswd/vpncloud.git
Using external siphasher to avoid warning
This commit is contained in:
parent
83d8bcfc1a
commit
4497ddaf13
|
@ -16,6 +16,7 @@ dependencies = [
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"signal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"signal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"siphasher 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"yaml-rust 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"yaml-rust 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -278,6 +279,11 @@ dependencies = [
|
||||||
"nix 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"nix 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "siphasher"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solicit"
|
name = "solicit"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
|
@ -443,6 +449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
|
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
|
||||||
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
||||||
"checksum signal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "beb615e58999635b6063277cf520f2d88824955c1056cf4f166b0f55b218512d"
|
"checksum signal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "beb615e58999635b6063277cf520f2d88824955c1056cf4f166b0f55b218512d"
|
||||||
|
"checksum siphasher 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c3c58c9ac43c530919fe6bd8ef11ae2612f64c2bf8eab9346f5b71ce0617f2"
|
||||||
"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2"
|
"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2"
|
||||||
"checksum strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "67f84c44fbb2f91db7fef94554e6b2ac05909c9c0b0bc23bb98d3a1aebfe7f7c"
|
"checksum strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "67f84c44fbb2f91db7fef94554e6b2ac05909c9c0b0bc23bb98d3a1aebfe7f7c"
|
||||||
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
||||||
|
|
|
@ -25,6 +25,7 @@ net2 = "0.2"
|
||||||
bitflags = "0.7"
|
bitflags = "0.7"
|
||||||
yaml-rust = "0.3"
|
yaml-rust = "0.3"
|
||||||
igd = "0.5"
|
igd = "0.5"
|
||||||
|
siphasher = "0.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gcc = "0.3"
|
gcc = "0.3"
|
||||||
|
|
|
@ -5,7 +5,8 @@ use super::types::{Mode, HeaderMagic};
|
||||||
use super::crypto::CryptoMethod;
|
use super::crypto::CryptoMethod;
|
||||||
use super::util::{Encoder, Duration};
|
use super::util::{Encoder, Duration};
|
||||||
|
|
||||||
use std::hash::{Hash, SipHasher, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
use siphasher::sip::SipHasher24;
|
||||||
|
|
||||||
|
|
||||||
#[derive(RustcDecodable, Debug, PartialEq)]
|
#[derive(RustcDecodable, Debug, PartialEq)]
|
||||||
|
@ -135,7 +136,7 @@ impl Config {
|
||||||
pub fn get_magic(&self) -> HeaderMagic {
|
pub fn get_magic(&self) -> HeaderMagic {
|
||||||
if let Some(ref name) = self.magic {
|
if let Some(ref name) = self.magic {
|
||||||
if name.starts_with("hash:") {
|
if name.starts_with("hash:") {
|
||||||
let mut s = SipHasher::new();
|
let mut s = SipHasher24::new();
|
||||||
name[6..].hash(&mut s);
|
name[6..].hash(&mut s);
|
||||||
let mut data = [0; 4];
|
let mut data = [0; 4];
|
||||||
Encoder::write_u32((s.finish() & 0xffffffff) as u32, &mut data);
|
Encoder::write_u32((s.finish() & 0xffffffff) as u32, &mut data);
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern crate fnv;
|
||||||
extern crate net2;
|
extern crate net2;
|
||||||
extern crate yaml_rust;
|
extern crate yaml_rust;
|
||||||
extern crate igd;
|
extern crate igd;
|
||||||
|
extern crate siphasher;
|
||||||
#[cfg(feature = "bench")] extern crate test;
|
#[cfg(feature = "bench")] extern crate test;
|
||||||
|
|
||||||
#[macro_use] pub mod util;
|
#[macro_use] pub mod util;
|
||||||
|
|
Loading…
Reference in New Issue