Coder Social home page Coder Social logo

libspooky's Introduction

LIBSPOOKY

Libspooky is a C implementation of Bob Jenkin's spooky hash algorithm.

INSTALLATION

To install libspooky from source execute the following steps:

git clone https://github.com/D3fy/libspooky.git
cd libspooky
./bootstrap
./configure
make
make install

DESCRIPTION

This is a C version of Bob Jenkin's spooky hash. The only advantage over Bob's original version is that it is in C, not C++ and comes with some test and benchmark code.

This is a very competitive hash function, but is somewhat unportable (64bit little endian only). It's more portable than some of the contenders like CityHash.

Quoting Bobs original description:

SpookyHash: a 128-bit noncryptographic hash function By Bob Jenkins, public domain

Oct 31 2010: alpha, framework + SpookyHash::Mix appears right
Oct 31 2011: alpha again, Mix only good to 2^^69 but rest appears right
Oct 11 2011: C version ported by Andi Kleen (andikleen@github)
Dec 31 2011: beta, improved Mix, tested it for 2-bit deltas
Feb  2 2012: production, same bits as beta
Feb  5 2012: adjusted definitions of uint* to be more portable
Mar 30 2012: 3 bytes/cycle, not 4.  Alpha was 4 but wasn't thorough enough.
Apr 27 2012: C version updated by Ziga Zupanec (agiz@github)
Feb 25 2015: C version converted to system library (graytshirt@github)

Up to 3 bytes/cycle for long messages. Reasonably fast for short messages. All 1 or 2 bit deltas achieve avalanche within 1% bias per output bit.

This was developed for and tested on 64-bit x86-compatible processors. It assumes the processor is little-endian. There is a macro controlling whether unaligned reads are allowed (by default they are). This should be an equally good hash on big-endian machines, but it will compute different results on them than on little-endian machines.

Google's CityHash has similar specs to SpookyHash, and CityHash is faster on some platforms. MD4 and MD5 also have similar specs, but they are orders of magnitude slower. CRCs are two or more times slower, but unlike SpookyHash, they have nice math for combining the CRCs of pieces to form the CRCs of wholes. There are also cryptographic hashes, but those are even slower than MD5.

SEE ALSO

LICENSE & COPYRIGHT

Libspooky is licensed under the GPL v3 license, see the included LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.