On 2023-04-10, at 2:18 PM, leves leves@caesar.elte.hu wrote:
...
WebClient's MD5 implementation uses primitiveMD5Transform of CroquetPlugin, so it's reasonably fast.
So it does; hadn't dug that far.
Looking at it I don't see any reason we couldn't do a tweak a bit like you use in the PG3ConnectionArguments>>#md5Hasher code *except* that it is a small puzzle why the WebUtils code seems to provide a result reversed from the MD5 code. Both senders of WebUtils class>>#md5HashStream: reverse the results, which seems a bit odd and a bit time-wasting.
If we were to change
^(ByteArray new: 16) unsignedLongAt: 1 put: (hash at: 4) bigEndian: true; unsignedLongAt: 5 put: (hash at: 3) bigEndian: true; unsignedLongAt: 9 put: (hash at: 2) bigEndian: true; unsignedLongAt: 13 put: (hash at: 1) bigEndian: true; yourself to
^(ByteArray new: 16) unsignedLongAt: 1 put: (hash at: 1) bigEndian: false; unsignedLongAt: 5 put: (hash at: 2) bigEndian: false; unsignedLongAt: 9 put: (hash at: 3) bigEndian: false; unsignedLongAt: 13 put: (hash at: 4) bigEndian: false; yourself
... it would simplify a little and make it easier to swap in the faster MD5 class. We get rid of two #reversed sends.
The other difference seems to be whether the hex chars should be upper or lower case - it is a little bad that #hex uses uppercase for everything but the ByteArray implementation but it looks like all the web related usages require that?
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful Latin Phrases:- Utinam logica falsa tuam philosophiam totam suffodiant! = May faulty logic undermine your entire philosophy!