Boost logo

Boost :

Subject: [boost] [rfc] Preliminary Hash Library
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-05-05 20:55:57


I've boostified, cleaned up, and documented the Hash Library I
mentioned here about a month ago. Comments, complaints, suggestions,
and questions appreciated.

Source code is in the sandbox at http://svn.boost.org/svn/boost/sandbox/hash/

Documentation can be read online at http://www.cs.mcgill.ca/~smcmur/hash/

I was very pleased by how the implementation came together, as
templates mean that all the hash algorithms share a substantial
portion of their code.

Those details are all hidden from the user, though. Here's an example
showing the simplest use of the library:

#include <boost/hash.hpp>

#include <iostream>
#include <string>

int main() {
    std::string s = "Hello World!";
    typedef boost::hash::sha2<256> HashPolicy;
    HashPolicy::digest_type digest = boost::hash::compute_digest<HashPolicy>(s);
    std::cout << digest << "\n";
}

Thanks,
~ Scott McMurray


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