Posts

Showing posts from April, 2015

Computing cryptography hashes: Rust, F#, D and Scala

Image
Let's compare how fast Rust, D and F# (.NET actually) at computing cryptography hashes, namely MD5, SHA1, SHA256 and SHA512. We're going to use rust-crypto cargo:

Results:
MD5 - 3.39s SHA1 - 2.89s SHA256 - 6.97sSHA512 - 4.47s
Now the F# code:

Results (.NET 4.5, VS 2013, F# 3.1):
MD5CryptoServiceProvider - 2.32s (32% faster)SHA1CryptoServiceProvider - 2.92s (1% slower)SHA256Managed - 16.50s (236% slower)SHA256CryptoServiceProvider - 11.50s (164% slower)SHA256Cng - 11.71s (168% slower)SHA512Managed - 61.04s (1365% slower)SHA512CryptoServiceProvider - 21.88s (489% slower)SHA512Cng - 22.19s (496% slower) (.NET 4.6, VS 2015, F# 4.0):

MD5CryptoServiceProvider elapled 2.55SHA1CryptoServiceProvider elapled 2.89SHA256Managed elapled 17.01SHA256CryptoServiceProvider elapled 8.74SHA256Cng elapled 8.75SHA512Managed elapled 23.42SHA512CryptoServiceProvider 5.81SHA512Cng elapled 5.79


D:


DMD
MD5 - 16.05s (470% slower)SHA1 - 2.35s (19% faster)SHA256 - 47.96s (690% slower (!))SHA512 - 61.47s (13…