Skip to content
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
8 changes: 4 additions & 4 deletions src/fnv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ const PRIME: u32 = 0x1000193;
/// Specifically this implements the [FNV-1a hash].
///
/// [FNV-1a hash]: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash
pub struct Hasher {
pub struct FnvHasher {
state: u32,
}

impl Default for Hasher {
impl Default for FnvHasher {
fn default() -> Self {
Self { state: BASIS }
}
}

impl crate::Hasher for Hasher {
impl crate::Hasher for FnvHasher {
#[inline]
fn finish32(&self) -> u32 {
self.state
}
}

impl core::hash::Hasher for Hasher {
impl core::hash::Hasher for FnvHasher {
#[inline]
fn write(&mut self, bytes: &[u8]) {
for byte in bytes {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
)]
#![no_std]

pub use crate::fnv::Hasher as FnvHasher;
pub use crate::murmur3::Hasher as Murmur3Hasher;
pub use crate::fnv::FnvHasher;
pub use crate::murmur3::Murmur3Hasher;

mod fnv;
mod murmur3;
Expand Down
10 changes: 5 additions & 5 deletions src/murmur3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::slice;
use crate::Hasher as _;

/// 32-bit `MurmurHash3` hasher
pub struct Hasher {
pub struct Murmur3Hasher {
buf: Buffer,
index: Index,
processed: u32,
Expand Down Expand Up @@ -50,7 +50,7 @@ impl From<usize> for Index {
}
}

impl Hasher {
impl Murmur3Hasher {
/// # Safety
///
/// The caller must ensure that `self.index.usize() + buf.len() <= 4`.
Expand All @@ -72,7 +72,7 @@ impl Hasher {
}
}

impl Default for Hasher {
impl Default for Murmur3Hasher {
fn default() -> Self {
Self {
buf: Buffer {
Expand All @@ -85,7 +85,7 @@ impl Default for Hasher {
}
}

impl crate::Hasher for Hasher {
impl crate::Hasher for Murmur3Hasher {
fn finish32(&self) -> u32 {
// tail
let mut state = match self.index {
Expand Down Expand Up @@ -128,7 +128,7 @@ impl crate::Hasher for Hasher {
}
}

impl core::hash::Hasher for Hasher {
impl core::hash::Hasher for Murmur3Hasher {
#[inline]
fn write(&mut self, bytes: &[u8]) {
let len = bytes.len();
Expand Down