Skip to content

Change SipHash2-4 -> SipHash1-3 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::any::{Any, TypeId};
use std::cell::RefCell;
use std::collections::HashMap;

use siphasher::sip128::{Hasher128, SipHasher};
use siphasher::sip128::{Hasher128, SipHasher13};

use crate::constraint::Join;
use crate::input::Input;
Expand All @@ -23,7 +23,7 @@ where
CACHE.with(|cache| {
// Compute the hash of the input's key part.
let key = {
let mut state = SipHasher::new();
let mut state = SipHasher13::new();
input.key(&mut state);
let hash = state.finish128().as_u128();
(id, hash)
Expand Down
4 changes: 2 additions & 2 deletions src/constraint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cell::RefCell;
use std::hash::Hash;

use siphasher::sip128::{Hasher128, SipHasher};
use siphasher::sip128::{Hasher128, SipHasher13};

use crate::track::Trackable;

Expand Down Expand Up @@ -121,7 +121,7 @@ where
/// Produce a 128-bit hash of a value.
#[inline]
pub fn hash<T: Hash>(value: &T) -> u128 {
let mut state = SipHasher::new();
let mut state = SipHasher13::new();
value.hash(&mut state);
state.finish128().as_u128()
}
Expand Down
4 changes: 2 additions & 2 deletions src/prehashed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::ops::Deref;

use siphasher::sip128::{Hasher128, SipHasher};
use siphasher::sip128::{Hasher128, SipHasher13};

/// A wrapper type with precomputed hash.
///
Expand Down Expand Up @@ -62,7 +62,7 @@ impl<T: Hash + 'static> Prehashed<T> {
fn hash<T: Hash + 'static>(item: &T) -> u128 {
// Also hash the TypeId because the type might be converted
// through an unsized coercion.
let mut state = SipHasher::new();
let mut state = SipHasher13::new();
item.type_id().hash(&mut state);
item.hash(&mut state);
state.finish128().as_u128()
Expand Down