Hi Tim,
On 2023. 04. 10. 3:14, tim Rowledge wrote:
Whilst slightly updating the WebServer Help page I noticed Andreas' comment that MD5 authentication was 'pathetic'. Certainly the simple version in WebUtils might be (I couldn't honestly judge it) but we do have a fairly serious crypto package these days. Has anybody ever made WebServer/Client use the presumably much faster MD5 in that package?
WebClient's MD5 implementation uses primitiveMD5Transform of CroquetPlugin, so it's reasonably fast.
The implementation in the Cryptography package is 2-6.5x faster depending on the input size.
On my machine, WebClient's throughput is ~43MB/s for a 8MB input, while the cryptography package reaches 283MB/s using CryptographyHashing-ul.26 [1].
For comparison, OpenSSL's h(and-tuned assembly) implementation reaches 600MB/s on my machine on 16kB inputs (that's the largest you can benchmark). Cryptography package gives 267MB/s for that size, so if you need the best performance available, perhaps an FFI call is the way to go.
Levente
[1] I just fixed a performance issue with the hash functions, so make sure you use the latest version of CryptographyHashing if you want to give that a try.
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim There are only two really difficult problems in programming: -Naming -Cache invalidation -Off-by-one errors