Btw, it looks rather odd to me that you inherit the hash state class into the base algorithm class. The hash state is supposed to contain the context for a specific hashing while the algorithm class has the static data (e.g. the polynomial). And the algorithm class (which is a module and hence just a single instance) cannot return itself as state, because then several hashings running in parallell would clobber each other.
I don't quite understand?
In Martin Nilsson's email he stated it should look like below, so `() returns CRCState.
Isn't this achieved by inheriting?
What do you mean by Clobbering? Isn't by inheriting for every new instance of CRC16 also a new instance of CRCState created?
The class CRCState is complete, except for the polynom. Should I create a CRCState object in the _CRC16 class and return it for `() ?
class CRC { string name(); int digest_size(); int block_size(); CRCState `() string hash(string data); }
class CRCState { string name(); int digest_size(); int block_size(); string hash(string data); CRCState update(string data); string digest(void|int length); }