pub struct SaltedHasher { /* private fields */ }Expand description
Consistent salted hasher for identifiers.
Implementations§
Source§impl SaltedHasher
impl SaltedHasher
Sourcepub fn hash_mac(&self, mac: &[u8; 6]) -> [u8; 6]
pub fn hash_mac(&self, mac: &[u8; 6]) -> [u8; 6]
Hash a MAC address (6 bytes) to a pseudonymous 6-byte MAC.
Uses SipHash-1-3 (Rust’s DefaultHasher) keyed with the salt.
The 64-bit hash output is truncated to 48 bits.
Sourcepub fn hash_mac_preserve_oui(&self, mac: &[u8; 6]) -> [u8; 6]
pub fn hash_mac_preserve_oui(&self, mac: &[u8; 6]) -> [u8; 6]
Hash a MAC address preserving the OUI (first 3 bytes).
This allows ML models to identify device manufacturers while still anonymizing the NIC-specific portion.
Sourcepub fn hash_bytes(&self, data: &[u8]) -> u64
pub fn hash_bytes(&self, data: &[u8]) -> u64
Hash an arbitrary byte slice to a 64-bit value.
Trait Implementations§
Source§impl Clone for SaltedHasher
impl Clone for SaltedHasher
Source§fn clone(&self) -> SaltedHasher
fn clone(&self) -> SaltedHasher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SaltedHasher
impl RefUnwindSafe for SaltedHasher
impl Send for SaltedHasher
impl Sync for SaltedHasher
impl Unpin for SaltedHasher
impl UnsafeUnpin for SaltedHasher
impl UnwindSafe for SaltedHasher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more