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
{
using result_type = /*integral or array<unsigned char, N>*/; // result type
HashAlgorithm(); // default-constructible
explicit HashAlgorithm( uint64_t seed ); // seed-constructible
HashAlgorithm( void const* seed, size_t n ); // seed-constructible
HashAlgorithm( HashAlgorithm const& r ); // copy-constructible
HashAlgorithm& operator=( HashAlgorithm const& r ); // assignable
void update( void const* data, size_t n ); // feed bytes
result_type result(); // obtain result; also advances state,
// and can be called multiple times
};
See the documentation for more information.
The library requires C++11. The following compilers:
are being tested on Github Actions and Appveyor.
Distributed under the Boost Software License, Version 1.0.
<h1>Hash2, a hash function library</h1> <p>This library contains an extensible framework for implementing hashing algorithms that can support user-defined types, based on the paper <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html">"Types don't know #"</a> by Howard Hinnant, Vinnie Falco and John Bytheway.</p> <p>It also contains implementations of several popular hashing algorithms:</p> <ul> <li><a href="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a</a></li> <li><a href="https://cyan4973.github.io/xxHash/">xxHash</a></li> <li><a href="https://en.wikipedia.org/wiki/SipHash">SipHash</a></li> <li><a href="https://tools.ietf.org/html/rfc1321">MD5</a></li> <li><a href="https://tools.ietf.org/html/rfc3174">SHA-1</a></li> <li><a href="https://tools.ietf.org/html/rfc6234">SHA-2</a></li> <li><a href="https://csrc.nist.gov/pubs/fips/202/final">SHA-3</a></li> <li><a href="https://homes.esat.kuleuven.be/%7Ebosselae/ripemd160.html">RIPEMD-160, RIPEMD-128</a></li> <li><a href="https://tools.ietf.org/html/rfc2104">HMAC</a></li> </ul> <p>The hashing algorithms conform to the following concept:</p> <pre class="highlightjs highlight"><code class="language- hljs">struct HashAlgorithm { using result_type = /*integral or array<unsigned char, N>*/; // result type HashAlgorithm(); // default-constructible explicit HashAlgorithm( uint64_t seed ); // seed-constructible HashAlgorithm( void const* seed, size_t n ); // seed-constructible HashAlgorithm( HashAlgorithm const& r ); // copy-constructible HashAlgorithm& operator=( HashAlgorithm const& r ); // assignable void update( void const* data, size_t n ); // feed bytes result_type result(); // obtain result; also advances state, // and can be called multiple times }; </code></pre> <p>See <a href="https://boost.org/libs/hash2/">the documentation</a> for more information.</p> <h2>Supported compilers</h2> <p>The library requires C++11. The following compilers:</p> <ul> <li>g++ 4.8 or later</li> <li>clang++ 3.9 or later</li> <li>Visual Studio 2015 and above</li> </ul> <p>are being tested on <a href="https://github.com/boostorg/hash2/actions/">Github Actions</a> and <a href="https://ci.appveyor.com/project/pdimov/hash2/">Appveyor</a>.</p> <h2>License</h2> <p>Distributed under the <a href="http://boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</p>
<h1>Hash2, a hash function library</h1> <p>This library contains an extensible framework for implementing hashing algorithms that can support user-defined types, based on the paper <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html">"Types don't know #"</a> by Howard Hinnant, Vinnie Falco and John Bytheway.</p> <p>It also contains implementations of several popular hashing algorithms:</p> <ul> <li><a href="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a</a></li> <li><a href="https://cyan4973.github.io/xxHash/">xxHash</a></li> <li><a href="https://en.wikipedia.org/wiki/SipHash">SipHash</a></li> <li><a href="https://tools.ietf.org/html/rfc1321">MD5</a></li> <li><a href="https://tools.ietf.org/html/rfc3174">SHA-1</a></li> <li><a href="https://tools.ietf.org/html/rfc6234">SHA-2</a></li> <li><a href="https://csrc.nist.gov/pubs/fips/202/final">SHA-3</a></li> <li><a href="https://homes.esat.kuleuven.be/%7Ebosselae/ripemd160.html">RIPEMD-160, RIPEMD-128</a></li> <li><a href="https://tools.ietf.org/html/rfc2104">HMAC</a></li> </ul> <p>The hashing algorithms conform to the following concept:</p> <pre class="highlightjs highlight"><code class="language- hljs">struct HashAlgorithm { using result_type = /*integral or array<unsigned char, N>*/; // result type HashAlgorithm(); // default-constructible explicit HashAlgorithm( uint64_t seed ); // seed-constructible HashAlgorithm( void const* seed, size_t n ); // seed-constructible HashAlgorithm( HashAlgorithm const& r ); // copy-constructible HashAlgorithm& operator=( HashAlgorithm const& r ); // assignable void update( void const* data, size_t n ); // feed bytes result_type result(); // obtain result; also advances state, // and can be called multiple times }; </code></pre> <p>See <a href="https://boost.org/libs/hash2/">the documentation</a> for more information.</p> <h2>Supported compilers</h2> <p>The library requires C++11. The following compilers:</p> <ul> <li>g++ 4.8 or later</li> <li>clang++ 3.9 or later</li> <li>Visual Studio 2015 and above</li> </ul> <p>are being tested on <a href="https://github.com/boostorg/hash2/actions/">Github Actions</a> and <a href="https://ci.appveyor.com/project/pdimov/hash2/">Appveyor</a>.</p> <h2>License</h2> <p>Distributed under the <a href="http://boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</p>