
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_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
+1 and one, minor suggestion: why not name `end_message` simply `end`? I am of the opinion that naming should follow the language's standard library conventions closely. And, as the STL uses short, concise member function names, it is best to mimic this.