aboutsummaryrefslogtreecommitdiff
path: root/lib/std/hash.zig
AgeCommit message (Collapse)Author
2025-07-31simplify std.hash.Adler32Andrew Kelley
2025-07-19std.hash.RapidHash: removeAndrew Kelley
Its design keeps evolving. See https://github.com/Nicoshev/rapidhash/releases It's great to see the design improving, but over time, this will lead to code rot; versions that aren't widely used but would still have to live in the standard library forever and be maintained. Better to be maintained as an external dependency that applications can opt into. Then, in a few years, if a version proves to be stable and widely adopted, it could be considered for inclusion in the standard library.
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-02-22Add rapidhash (#22085)Chris Covington
2024-11-24std.hash.int: avoid words like "easy" and "fast" in doc commentsAndrew Kelley
2024-11-24std.hash.int: better handle odd bit sizesFrancesco Alemanno
Uses the non rational solution of a quadratic, I made it work up to 256 bits, added Mathematica code in case anyone wants to verify the magic constant. integers between sizes 3...15 were affected by fatal bias, it is best to make them pass through the generic solution. Thanks to RetroDev256 & Andrew feedback.
2024-11-24std.hash.int: restore previous behaviorAndrew Kelley
In the parent commit, I handled odd bit sizes by upcasting and truncating. However it seems the else branch is intended to handle those cases instead, so this commit reverts that behavior.
2024-11-24std.hash.int: use anytype instead of explicit type parameterAndrew Kelley
also * allow signed ints, simply bitcast them to unsigned * handle odd bit sizes by upcasting and then truncating * naming conventions * remove redundant code * better use of testing API
2024-11-24std.hash: improve simple hashing of unsigned integersFrancesco Alemanno
Before, the default bit mixer was very biased, and after a lot of searching it turns out that selecting a better solution is hard. I wrote a custom statistical analysis taylored for bit mixers in order to select the best one at each size (u64/u32/u16), compared a lot of mixers, and packaged the best ones in this commit.
2023-10-17XXH3 Implementation for Zig STD (#17530)David
XXH3 is the faster alternative to XXH64 which utilizes SIMD when hashing large chunks of memory and similar mixing to WyHash (64x64 -> 128 mul) for smaller inputs. Co-authored-by: Reixcon226 <87927264+Rexicon226@users.noreply.github.com> --------- Co-authored-by: kprotty <kbutcher6200@gmail.com>
2023-06-10add std.hash.uint32Andrew Kelley
This is handy if you have a u32 and want a u32 and don't want to take a detour through many layers of abstraction elsewhere in the std.hash namespace. Copied from https://nullprogram.com/blog/2018/07/31/
2023-04-21std: remove names from incorrectly named testsJacob Young
Tests that only reference decls for the purpose of analyzing more tests should be unnamed, otherwise trying to filter for just a referenced test can become impossible depending on the names.
2023-02-20std.hash: add XxHash64 and XxHash32dweiller
2022-01-07lint: duplicate import (#10519)Meghan
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2020-12-31Year++Frank Denis
2020-08-22Promote hash/siphash to crypto/siphashFrank Denis
SipHash *is* a cryptographic function, with a 128-bit security level. However, it is not a regular hash function: a secret key is required, and knowledge of that key allows collisions to be quickly computed offline. SipHash is therefore more suitable to be used as a MAC. The same API as other MACs was implemented in addition to functions directly returning an integer. The benchmarks have been updated accordingly. No changes to the SipHash implementation itself.
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2019-10-11merge dumps tool: merging ast nodesAndrew Kelley
-fgenerate-docs is replaced ith -femit-docs -fno-emit-bin is added to prevent outputting binary
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221