1 stable release

1.0.0 Dec 3, 2024

#685 in Algorithms

Download history 139/week @ 2024-12-02 7/week @ 2024-12-09

146 downloads per month

CC0 license

220KB
4.5K SLoC

C 3K SLoC // 0.2% comments Rust 1.5K SLoC // 0.0% comments

FNV Hash

CC0 Crates.io version MSRV 1.57 Safe Rust Patent-Free Documentation Crates.io Downloads

Fowler/Noll/Vo hash

The basis of this hash algorithm was taken from an idea sent as reviewer comments to the IEEE POSIX P1003.2 committee by: Phong Vo, Glenn Fowler. In a subsequent ballot round Landon Curt Noll improved on their algorithm.

People tried this hash and found that it worked rather well. In an EMail message to Landon, they named it the Fowler/Noll/Vo or FNV hash.

FNV hashes are designed to be fast while maintaining a low collision rate. The FNV speed allows one to quickly hash lots of data while maintaining a reasonable collision rate. More details and other forms of the FNV hash.

32/64/128 bit versions

Rust crate fnv0 includes 32, 64, 128 bit versions of FNV hash 0, 1, 1a. Testsuite for 32 and 64 bit versions is ported from C code. 128 bit version is tested only against initial value.

FNV hash algorithms and source code been been put into the public domain via the following Creative Commons license:

CC0

CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. No Copyright - CC0 - No Rights Reserved.

The CC0 license means that the hash algorithms and source code has been dedicated to the public domain by waiving all of our rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.

You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

 * Please do not copyright this code.  This code is in the public domain.
 *
 * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
 * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 * By:
 *	chongo <Landon Curt Noll> /\oo/\
 *      http://www.isthe.com/chongo/
 *
 * Share and Enjoy!	:-)

Patent free

We did NOT patent FNV. The authors of the FNV algorithm took deliberate steps to disclose the algorithm in a public forum soon after it was invented. More than a year passed after this public disclosure and the authors deliberately took no steps to patent the FNV algorithm. Therefore it is safe to say that the FNV authors have no patent claims on the FNV algorithm as published.

Dependencies

~2MB
~44K SLoC