I have been working on implementations of the SHA and FNV-1a class of
hashing algorithms. Both are header-only.
<snip>
Would these algorithms be of general use to the Boost community?
Yes. Absolutely.
I thought there were some restrictive licensing conditions on the
algorithms themselves that were incompatible with BPL.
But others will know this better than I do.
I have two suggestions, if it ever gets that far.
1) Consider making the interface similar to Boost's CRC
interface, which already exists. I think this does the
init --- digest --- finish thing, more or less, whereby
the concept of the final XOR value might be the finish.
2) Please, please please make them templates suitable
for use in *all* systems including 8-bit through 64-bit
microcontrollers. Thereby I explicitly mean making the
so called "padding length" (of bits in your case) a template
parameter. Hash algos with any kind of 64-bit use are
can not be sensibly ported to a wide range of micros.
I have MD5, SHA1, SHA-256 proven to work, header
only on 8-bit through 64-bit compilers that have been
tested in hard real time if any interest. These are,
however byte-oriented.
Keep going!
Sincerely, Chris.
On Wednesday, November 13, 2013 1:40 AM, foster brereton wrote:
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.h...
(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.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost