Am Mo 14. Jan 2013, 20:29:53, MSHELOR schrieb:
Show quoted text>
> Note that "adding Unicode strings" to digest objects is a meaningless
What is meaningless? Adding unicode|iso-8859|whatever strings,
adding a sequence of image data? Adding any data?
Show quoted text> concept: SHA algorithms operate on sequences of bytes, whereas
> Unicode strings contain wide characters.
Yes, SHA should operate on bytes and not on chars. A Digest shall not
care about what those bytes are.
It's perl who must handle unicode encoded strings in a special manner
on string operations e.g. "length(), substr()".
Show quoted text>
> By convention (ref. Digest::SHA1 and Digest::MD5), the appropriate
> response upon receiving a wide character is for the digest function
> to croak. So, this is what Digest::SHA and Digest::SHA::PurePerl
> now do as of 5.74 and 5.81, respectively.
>
I don't see a convention not using strings for a digest message.
From "Digest::MD5":
Show quoted text> Since the MD5 algorithm is only defined for strings of bytes, it can
> not be used on strings that contains chars with ordinal number above
> 255.
That is a mistake!
Perl got the "use bytes" pragma to force byte semantics
rather than character semantics (see perldoc bytes)