On 18 April 2016 at 13:03, Vinnie Falco
On Mon, Apr 18, 2016 at 6:55 AM, Thijs van den Berg
wrote: Maybe it's a good idea to release you version using the std::hash (or boost:hash) interface, although a separte library of common predefined hash function would be a more natural place for it?
We've got a proposal winding its way through the C++ standard process which provides a new interface to computing hashes on objects suitable for use with unordered containers: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html
The problem is that while these interfaces are great for the purposes of generating 32-bit or 64-bit digests for hash tables, they are deficient for cryptographic purposes (i.e. producing a message authentication code). For example, regular std::hash doesn't deal with endiannes. But computing a cryptographic digest must yield the same results on all platforms, and therefore cares about endianness.
maybe that could also belong in a generic function that converting native integers to some endian specific digests? Whatever the answer, I think the most pragmatic way forward for you would be to put it in your personal detail and postpone this side discussion of a widening the scope of your library (proving a public SHA1) to later?