Skip to content
A hash function library
C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmark
include/boost/hash2
test
.gitattributes
.travis.yml
README.md
appveyor.yml

README.md

Hash2, a hash function library

This library contains an extensible framework for implementing hashing algorithms that can support user-defined types, based on the paper "Types don't know #" by Howard Hinnant, Vinnie Falco and John Bytheway.

It also contains implementations of several popular hashing algorithms:

The hashing algorithms conform to the following concept:

struct HashAlgorithm
{
    typedef /*integral or array<byte_type, N>*/ result_type; // result type
    typedef /*unsigned integral*/ size_type; // how is container.size() hashed

    HashAlgorithm(); // default-constructible
    explicit HashAlgorithm( uint64_t seed ); // seed-constructible
    HashAlgorithm( byte_type const* seed, ptrdiff_t n ); // seed-constructible

    HashAlgorithm( HashAlgorithm const& r ); // copy-constructible
    HashAlgorithm& operator=( HashAlgorithm const& r ); // assignable

    void update( byte_type const* data, ptrdiff_t n ); // feed bytes

    result_type result(); // obtain result; also advances state,
                          // and can be called multiple times
};

Supported compilers

The library supports C++03 and does not require C++11. The following compilers:

  • g++ 4.4 or later
  • clang++ 3.3 or later
  • Visual Studio 2008 and above

are being tested on Travis and Appveyor.

In addition, Visual Studio 2005 is also supported.

Documentation

None yet.

Planned Additions

  • Documentation (obv.)
  • SHA2-256, 384, 512
  • Support for endian-independent hashing
  • An std::hash-compatible adaptor
  • A type-erased hash_function
  • A hash2sum example

License

Distributed under the Boost Software License, Version 1.0.

You can’t perform that action at this time.