Hi .. I know that I could test it my way ... But perhaps, someone has already do it ?!
When computing sha256 ... on my computer I reached to compute 10M of sha256 in less than 7 seconds ... with nimSHA2. But I would like to know if there are others implentations which could beat that ? because I've found a lot of others : nimcrypto, constantine, etc ... (or interface with openssl)
Thanks !
#! nim c -d:danger -r
import nimSHA2
import nimcrypto
import times
import libsha / sha256
let x=10_000_000
var t=getTime()
for i in 0 .. x:
let h=sha256hexdigest($i) # libsha
echo "LIBSHA: ",getTime() - t
t=getTime()
for i in 0 .. x:
let h=nimcrypto.sha256.digest($i) #nimcrypto
echo "NIMCRYPTO: ",getTime() - t
t=getTime()
for i in 0 .. x:
let h=nimSHA2.computeSHA256($i).toHex() #nimsha2
echo "NIMSHA2: ",getTime() - t
produces
LIBSHA: 7 seconds, 901 milliseconds, 85 microseconds, and 397 nanoseconds
NIMCRYPTO: 10 seconds, 741 milliseconds, 381 microseconds, and 115 nanoseconds
NIMSHA2: 27 seconds, 745 milliseconds, 682 microseconds, and 370 nanoseconds