diff --git a/compare/readme.md b/compare/readme.md index 58146e5..e7a6c53 100644 --- a/compare/readme.md +++ b/compare/readme.md @@ -25,7 +25,7 @@ Even the fallback algorithm is in the top 5 in terms of throughput, beating out aHash is the fastest non-trivial hasher implementation in Rust. Below is a comparison with 10 other popular hashing algorithms. -![Hasher perfromance](https://docs.google.com/spreadsheets/d/e/2PACX-1vSK7Li2nS-Bur9arAYF9IfT37MP-ohAe1v19lZu5fd9MajI1fSveLAQZyEie4Ea9k5-SWHTff7nL2DW/pubchart?oid=1323618938&format=image) +![Hasher performance](https://docs.google.com/spreadsheets/d/e/2PACX-1vSK7Li2nS-Bur9arAYF9IfT37MP-ohAe1v19lZu5fd9MajI1fSveLAQZyEie4Ea9k5-SWHTff7nL2DW/pubchart?oid=1323618938&format=image) ## DOS resistance @@ -120,4 +120,4 @@ Similarly, wyHash is targeted at hashmaps. WyHash is quite fast, but is not DOS There are fixed strings which when encountered caused the internal state to reset. This makes wyHash trivial to attack. -AHash outperforms wyHash across all input sizes, regardless of which CPU instructions are available. \ No newline at end of file +AHash outperforms wyHash across all input sizes, regardless of which CPU instructions are available. diff --git a/src/hash_quality_test.rs b/src/hash_quality_test.rs index 4f6091a..43f2aeb 100644 --- a/src/hash_quality_test.rs +++ b/src/hash_quality_test.rs @@ -108,13 +108,13 @@ fn test_keys_change_output(constructor: impl Fn(u128, u128) -> T) { fn test_input_affect_every_byte(constructor: impl Fn(u128, u128) -> T) { let base = hash_with(&0, constructor(0, 0)); for shift in 0..16 { - let mut alternitives = vec![]; + let mut alternatives = vec![]; for v in 0..256 { let input = (v as u128) << (shift * 8); let hasher = constructor(0, 0); - alternitives.push(hash_with(&input, hasher)); + alternatives.push(hash_with(&input, hasher)); } - assert_each_byte_differs(shift, base, alternitives); + assert_each_byte_differs(shift, base, alternatives); } } @@ -122,26 +122,26 @@ fn test_input_affect_every_byte(constructor: impl Fn(u128, u128) -> T fn test_keys_affect_every_byte(item: H, constructor: impl Fn(u128, u128) -> T) { let base = hash_with(&item, constructor(0, 0)); for shift in 0..16 { - let mut alternitives1 = vec![]; - let mut alternitives2 = vec![]; + let mut alternatives1 = vec![]; + let mut alternatives2 = vec![]; for v in 0..256 { let input = (v as u128) << (shift * 8); let hasher1 = constructor(input, 0); let hasher2 = constructor(0, input); let h1 = hash_with(&item, hasher1); let h2 = hash_with(&item, hasher2); - alternitives1.push(h1); - alternitives2.push(h2); + alternatives1.push(h1); + alternatives2.push(h2); } - assert_each_byte_differs(shift, base, alternitives1); - assert_each_byte_differs(shift, base, alternitives2); + assert_each_byte_differs(shift, base, alternatives1); + assert_each_byte_differs(shift, base, alternatives2); } } -fn assert_each_byte_differs(num: u64, base: u64, alternitives: Vec) { +fn assert_each_byte_differs(num: u64, base: u64, alternatives: Vec) { let mut changed_bits = 0_u64; - for alternitive in alternitives { - changed_bits |= base ^ alternitive + for alternative in alternatives { + changed_bits |= base ^ alternative } assert_eq!( core::u64::MAX, diff --git a/src/lib.rs b/src/lib.rs index 2086513..500f430 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,7 +77,7 @@ use ahash::AHashMap; let mut map: AHashMap = AHashMap::new(); map.insert(12, 34); ``` -This avoids the need to type "RandomState". (For convience `From`, `Into`, and `Deref` are provided). +This avoids the need to type "RandomState". (For convenience `From`, `Into`, and `Deref` are provided). # Aliases