$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Message Hashing Interface (SHA-1/256/384/512, MD4/5)
From: Daniel Trebbien (dtrebbien_at_[hidden])
Date: 2010-04-10 11:45:29
>> 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.