Boost logo

Boost :

Subject: [boost] Any interest in hashing algorithms SHA and/or FNV1a?
From: foster brereton (fosterb+boost_at_[hidden])
Date: 2013-11-12 13:52:45


I have been working on implementations of the SHA and FNV-1a class of
hashing algorithms. Both are header-only.

SHA (Secure Hash Algorithms)
Implementations for SHA-1, -224, -256, -384, and -512. It does not
implement the more recent SHA-3 (Keccak) algorithm. It would not be
difficult to add support for 512/224 and 512/256 if they were desired.
The routines support bit-level messages, meaning they can correctly
digest messages that do not end on a byte boundary. More information
here:
    http://en.wikipedia.org/wiki/Secure_Hash_Algorithm

FNV (Fowler–Noll–Vo)
The header supports the FNV-1a algorithm, which has better
distribution characteristics than its cousin, FNV-1. I have added
support for 32-, 64-, 128-, 256-, and 1024-bit variants. This is not a
cryptographically secure algorithm, however is much faster than its
crypto cousins and as such is a solid algorithm for obtaining unique
hash values for e.g., data structures. I have also implemented a
constexpr variant of the algorithm (32-bit and 64-bit only) for const
char* to further performance when needed by pushing the hash to
compile-time computation.
More information here:
    http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

The algorithms are currently part of the Adobe Source Libraries on GitHub:

SHA:
https://github.com/stlab/adobe_source_libraries/blob/sha_cleanup/adobe/sha.hpp
(note: the master branch version needs updating to this one.)

FNV-1a:
https://github.com/stlab/adobe_source_libraries/blob/master/adobe/fnv.hpp

Would these algorithms be of general use to the Boost community? If so
I would be willing to submit them formally.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk