[Pharo-project] CRC in System-Hashing?
maxleske at gmail.com
Fri Mar 2 10:45:51 EST 2012
Oops! #hashStream: *does* actually take a stream… #hashMessage: takes a string or a ByteArray and sends #readStream to the argument.
So: different proposal: drop #hashMessage: completely. Instead add:
SHA1 class>>hashStream: aPositionableStream
^ self new
Thanks Igor for unintentionally bumping me in the head :)
On 02.03.2012, at 15:03, Igor Stasenko wrote:
> On 2 March 2012 10:21, Max Leske <maxleske at gmail.com> wrote:
>> Thanks for the responses.
>> I'll wait a little longer and see if Rob has anything to say about this.
>> Otherwise I will do what Henrik suggests:
>> deprecate SecureHashAlgorithm (why not remove it completely?)
>> refactor users of SecureHashAlogrithm to use SHA1 instead
>> add CRC to SystemHashing (possibly a copy from Cryptography)
>> refactor the Zip implementation to use the new CRC class
>> deprecate crc methods in Zip implementation
>> I actually like #hashMessage: better than #hashStream:. #hashStream: says to
>> my "I expect a stream as my argument" where in reality it will take a string
>> or a ByteArray (neither of which is obviously a stream…).
>> What I found irritating though was that one has to send #new to
>> SecureHashAlgorithm first before hashing. So I propose to keep #hashMessage:
>> but to move it to the class side of SHA1:
>> SHA1 class>>hashMessage: aStringOrByteArray
>> ^ self new
>> hashStream: aStringOrByteArray;
> hmm.. #hashMessage: sounds a bit weird to my taste.
> maybe #hashCollection: then?
> Best regards,
> Igor Stasenko.
More information about the Pharo-dev