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 hashStream: aPositionableStream; yourself 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@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; yourself
hmm.. #hashMessage: sounds a bit weird to my taste. maybe #hashCollection: then?
Cheers, Max
-- Best regards, Igor Stasenko.