Models of the HashAlgorithm concept are policies to be provided as template arguments to other templates. They provide access to the set of types needed to generically compute and store digests with a particular algorithm. (For example, the compute_digest function templates are parametrized by a HashAlgorithm, as would a future HMAC-computing function template.)
A type T modelling the HashAlgorithm concept must support the following:
Provided models:
Header | Type | digest_type |
---|---|---|
<boost/hash/adler.hpp> | adler<h>, with h in {8, 16, 24, ..., 64} | digest<h> |
<boost/hash/crc.hpp> | crc<h, ...>, with template arguments as for Boost.CRC's crc_optimal | digest<h> |
<boost/hash/cubehash.hpp> | cubehash<h>, cubehash<r, b, h>, with h in {8, 16, 24, ..., 512}, r in {1, 2, 3, ...} (default 16), b in {4, 8, 12, ..., 128} (default 32) | digest<h> |
<boost/hash/md4.hpp> | md4 | digest<128> |
<boost/hash/md5.hpp> | md5 | digest<128> |
<boost/hash/sha.hpp> | sha, sha0 | digest<128> |
<boost/hash/sha1.hpp> | sha1 | digest<160> |
<boost/hash/sha2.hpp> | sha2<h>, with h in {224, 256, 384, 512} | digest<h> |
A type T modelling the StreamHash<ValueBits> concept must be default-constructible, copy-constructible, and copy-assignable, as well as support the following (h is an object of type T, hc is an object of type T const):
Each HashAlgorithm model provides access to all its associated StreamHash models; Those StreamHash models are generally not accessible in other ways.
Previous: Functions | Next: Performance |
Copyright Scott McMurray 2010
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).