
On 04/06/2010 10:55 AM, Scott McMurray wrote:
On 6 April 2010 10:55, Rob Riggs<rob@pangalactic.org> wrote:
This is also the scheme used by crypto++ (C++), the Perl API, PyCrypto (Python) and openssl (C). I think the Boost crypto hash API should more closely mimic the existing de facto standard interfaces as much as possible.
Thanks for the references. They're not completely consistent, though.
I do like the idea that digest() be const, since conceptually it's just inspecting the result of the previous updates.
Here's a hybrid idea, with definitions to show equivalences:
class hash { public: void update(byte); void reset() { *this = hash(); } digest_type digest() const { return hash(*this).end_of_message(); } digest_type end_message() { digest_type h = digest(); reset(); return h; } };
That way it provides for rolling or message-oriented digests, and adapts for the other as best it can if needed.
Is that a reasonable compromise?
I like it! Rob