Skip to content

Instantly share code, notes, and snippets.

@dllz
Created December 1, 2022 11:44
Show Gist options
  • Save dllz/d31616500bd5a3eae1a434e6f890d330 to your computer and use it in GitHub Desktop.
Save dllz/d31616500bd5a3eae1a434e6f890d330 to your computer and use it in GitHub Desktop.
Benchmark of all the node crypto hashes
Avg for RSA-MD4 2381
Avg for RSA-MD5 2467.2
Avg for RSA-MDC2 15642.4
Avg for RSA-RIPEMD160 2819
Avg for RSA-SHA1 2389.6
Avg for RSA-SHA1-2 2090.8
Avg for RSA-SHA224 2396
Avg for RSA-SHA256 2363.4
Avg for RSA-SHA3-224 2540.8
Avg for RSA-SHA3-256 2604.2
Avg for RSA-SHA3-384 2733.8
Avg for RSA-SHA3-512 3207.4
Avg for RSA-SHA384 2256
Avg for RSA-SHA512 2256.2
Avg for RSA-SHA512/224 2272.4
Avg for RSA-SHA512/256 2296
Avg for RSA-SM3 2944.2
Avg for blake2b512 2072.2
Avg for blake2s256 2318.8
Avg for id-rsassa-pkcs1-v1_5-with-sha3-224 2621.8
Avg for id-rsassa-pkcs1-v1_5-with-sha3-256 2622.8
Avg for id-rsassa-pkcs1-v1_5-with-sha3-384 2799.4
Avg for id-rsassa-pkcs1-v1_5-with-sha3-512 3246.4
Avg for md4 2082.6
Avg for md4WithRSAEncryption 2143
Avg for md5 2169.4
Avg for md5-sha1 2395
Avg for md5WithRSAEncryption 2205.6
Avg for mdc2 15564.4
Avg for mdc2WithRSA 15875.2
Avg for ripemd 2406
Avg for ripemd160 2428.6
Avg for ripemd160WithRSA 2321.2
Avg for rmd160 2345.2
Avg for sha1 1910
Avg for sha1WithRSAEncryption 1937.8
Avg for sha224 2210.4
Avg for sha224WithRSAEncryption 2313.2
Avg for sha256 2223.2
Avg for sha256WithRSAEncryption 2329.8
Avg for sha3-224 2358.4
Avg for sha3-256 2358
Avg for sha3-384 2545
Avg for sha3-512 2987.8
Avg for sha384 2121.6
Avg for sha384WithRSAEncryption 2232.4
Avg for sha512 2171.8
Avg for sha512-224 2215.2
Avg for sha512-224WithRSAEncryption 2327
Avg for sha512-256 2170.6
Avg for sha512-256WithRSAEncryption 2445
Avg for sha512WithRSAEncryption 2201.6
Avg for shake128 2365.6
Avg for shake256 2385.6
Avg for sm3 2742.4
Avg for sm3WithRSAEncryption 2798.6
Avg for ssl3-md5 2017.2
Avg for ssl3-sha1 1975.4
Avg for whirlpool 3087
block size: 512
testing RSA-MD4
hashing RSA-MD4 x 300000 times: 2326ms
hashing RSA-MD4 x 300000 times: 2387ms
hashing RSA-MD4 x 300000 times: 2320ms
hashing RSA-MD4 x 300000 times: 2438ms
hashing RSA-MD4 x 300000 times: 2434ms
Avg for RSA-MD4 2381
testing RSA-MD5
hashing RSA-MD5 x 300000 times: 2446ms
hashing RSA-MD5 x 300000 times: 2420ms
hashing RSA-MD5 x 300000 times: 2503ms
hashing RSA-MD5 x 300000 times: 2480ms
hashing RSA-MD5 x 300000 times: 2487ms
Avg for RSA-MD5 2467.2
testing RSA-MDC2
hashing RSA-MDC2 x 300000 times: 15549ms
hashing RSA-MDC2 x 300000 times: 15736ms
hashing RSA-MDC2 x 300000 times: 15711ms
hashing RSA-MDC2 x 300000 times: 15604ms
hashing RSA-MDC2 x 300000 times: 15612ms
Avg for RSA-MDC2 15642.4
testing RSA-RIPEMD160
hashing RSA-RIPEMD160 x 300000 times: 2780ms
hashing RSA-RIPEMD160 x 300000 times: 2717ms
hashing RSA-RIPEMD160 x 300000 times: 2765ms
hashing RSA-RIPEMD160 x 300000 times: 3019ms
hashing RSA-RIPEMD160 x 300000 times: 2814ms
Avg for RSA-RIPEMD160 2819
testing RSA-SHA1
hashing RSA-SHA1 x 300000 times: 2450ms
hashing RSA-SHA1 x 300000 times: 2412ms
hashing RSA-SHA1 x 300000 times: 2392ms
hashing RSA-SHA1 x 300000 times: 2305ms
hashing RSA-SHA1 x 300000 times: 2389ms
Avg for RSA-SHA1 2389.6
testing RSA-SHA1-2
hashing RSA-SHA1-2 x 300000 times: 2054ms
hashing RSA-SHA1-2 x 300000 times: 2043ms
hashing RSA-SHA1-2 x 300000 times: 2141ms
hashing RSA-SHA1-2 x 300000 times: 2080ms
hashing RSA-SHA1-2 x 300000 times: 2136ms
Avg for RSA-SHA1-2 2090.8
testing RSA-SHA224
hashing RSA-SHA224 x 300000 times: 2381ms
hashing RSA-SHA224 x 300000 times: 2431ms
hashing RSA-SHA224 x 300000 times: 2420ms
hashing RSA-SHA224 x 300000 times: 2377ms
hashing RSA-SHA224 x 300000 times: 2371ms
Avg for RSA-SHA224 2396
testing RSA-SHA256
hashing RSA-SHA256 x 300000 times: 2396ms
hashing RSA-SHA256 x 300000 times: 2368ms
hashing RSA-SHA256 x 300000 times: 2357ms
hashing RSA-SHA256 x 300000 times: 2307ms
hashing RSA-SHA256 x 300000 times: 2389ms
Avg for RSA-SHA256 2363.4
testing RSA-SHA3-224
hashing RSA-SHA3-224 x 300000 times: 2541ms
hashing RSA-SHA3-224 x 300000 times: 2572ms
hashing RSA-SHA3-224 x 300000 times: 2540ms
hashing RSA-SHA3-224 x 300000 times: 2559ms
hashing RSA-SHA3-224 x 300000 times: 2492ms
Avg for RSA-SHA3-224 2540.8
testing RSA-SHA3-256
hashing RSA-SHA3-256 x 300000 times: 2605ms
hashing RSA-SHA3-256 x 300000 times: 2552ms
hashing RSA-SHA3-256 x 300000 times: 2609ms
hashing RSA-SHA3-256 x 300000 times: 2583ms
hashing RSA-SHA3-256 x 300000 times: 2672ms
Avg for RSA-SHA3-256 2604.2
testing RSA-SHA3-384
hashing RSA-SHA3-384 x 300000 times: 2732ms
hashing RSA-SHA3-384 x 300000 times: 2753ms
hashing RSA-SHA3-384 x 300000 times: 2701ms
hashing RSA-SHA3-384 x 300000 times: 2773ms
hashing RSA-SHA3-384 x 300000 times: 2710ms
Avg for RSA-SHA3-384 2733.8
testing RSA-SHA3-512
hashing RSA-SHA3-512 x 300000 times: 3259ms
hashing RSA-SHA3-512 x 300000 times: 3217ms
hashing RSA-SHA3-512 x 300000 times: 3154ms
hashing RSA-SHA3-512 x 300000 times: 3193ms
hashing RSA-SHA3-512 x 300000 times: 3214ms
Avg for RSA-SHA3-512 3207.4
testing RSA-SHA384
hashing RSA-SHA384 x 300000 times: 2238ms
hashing RSA-SHA384 x 300000 times: 2298ms
hashing RSA-SHA384 x 300000 times: 2204ms
hashing RSA-SHA384 x 300000 times: 2305ms
hashing RSA-SHA384 x 300000 times: 2235ms
Avg for RSA-SHA384 2256
testing RSA-SHA512
hashing RSA-SHA512 x 300000 times: 2293ms
hashing RSA-SHA512 x 300000 times: 2245ms
hashing RSA-SHA512 x 300000 times: 2254ms
hashing RSA-SHA512 x 300000 times: 2259ms
hashing RSA-SHA512 x 300000 times: 2230ms
Avg for RSA-SHA512 2256.2
testing RSA-SHA512/224
hashing RSA-SHA512/224 x 300000 times: 2267ms
hashing RSA-SHA512/224 x 300000 times: 2256ms
hashing RSA-SHA512/224 x 300000 times: 2269ms
hashing RSA-SHA512/224 x 300000 times: 2279ms
hashing RSA-SHA512/224 x 300000 times: 2291ms
Avg for RSA-SHA512/224 2272.4
testing RSA-SHA512/256
hashing RSA-SHA512/256 x 300000 times: 2290ms
hashing RSA-SHA512/256 x 300000 times: 2295ms
hashing RSA-SHA512/256 x 300000 times: 2312ms
hashing RSA-SHA512/256 x 300000 times: 2270ms
hashing RSA-SHA512/256 x 300000 times: 2313ms
Avg for RSA-SHA512/256 2296
testing RSA-SM3
hashing RSA-SM3 x 300000 times: 2936ms
hashing RSA-SM3 x 300000 times: 2974ms
hashing RSA-SM3 x 300000 times: 2953ms
hashing RSA-SM3 x 300000 times: 2978ms
hashing RSA-SM3 x 300000 times: 2880ms
Avg for RSA-SM3 2944.2
testing blake2b512
hashing blake2b512 x 300000 times: 2091ms
hashing blake2b512 x 300000 times: 2052ms
hashing blake2b512 x 300000 times: 2084ms
hashing blake2b512 x 300000 times: 2042ms
hashing blake2b512 x 300000 times: 2092ms
Avg for blake2b512 2072.2
testing blake2s256
hashing blake2s256 x 300000 times: 2306ms
hashing blake2s256 x 300000 times: 2296ms
hashing blake2s256 x 300000 times: 2304ms
hashing blake2s256 x 300000 times: 2360ms
hashing blake2s256 x 300000 times: 2328ms
Avg for blake2s256 2318.8
testing id-rsassa-pkcs1-v1_5-with-sha3-224
hashing id-rsassa-pkcs1-v1_5-with-sha3-224 x 300000 times: 2690ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-224 x 300000 times: 2587ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-224 x 300000 times: 2631ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-224 x 300000 times: 2582ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-224 x 300000 times: 2619ms
Avg for id-rsassa-pkcs1-v1_5-with-sha3-224 2621.8
testing id-rsassa-pkcs1-v1_5-with-sha3-256
hashing id-rsassa-pkcs1-v1_5-with-sha3-256 x 300000 times: 2607ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-256 x 300000 times: 2664ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-256 x 300000 times: 2597ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-256 x 300000 times: 2613ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-256 x 300000 times: 2633ms
Avg for id-rsassa-pkcs1-v1_5-with-sha3-256 2622.8
testing id-rsassa-pkcs1-v1_5-with-sha3-384
hashing id-rsassa-pkcs1-v1_5-with-sha3-384 x 300000 times: 2920ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-384 x 300000 times: 2726ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-384 x 300000 times: 2833ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-384 x 300000 times: 2750ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-384 x 300000 times: 2768ms
Avg for id-rsassa-pkcs1-v1_5-with-sha3-384 2799.4
testing id-rsassa-pkcs1-v1_5-with-sha3-512
hashing id-rsassa-pkcs1-v1_5-with-sha3-512 x 300000 times: 3218ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-512 x 300000 times: 3341ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-512 x 300000 times: 3267ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-512 x 300000 times: 3230ms
hashing id-rsassa-pkcs1-v1_5-with-sha3-512 x 300000 times: 3176ms
Avg for id-rsassa-pkcs1-v1_5-with-sha3-512 3246.4
testing md4
hashing md4 x 300000 times: 2132ms
hashing md4 x 300000 times: 2096ms
hashing md4 x 300000 times: 2115ms
hashing md4 x 300000 times: 2044ms
hashing md4 x 300000 times: 2026ms
Avg for md4 2082.6
testing md4WithRSAEncryption
hashing md4WithRSAEncryption x 300000 times: 2155ms
hashing md4WithRSAEncryption x 300000 times: 2221ms
hashing md4WithRSAEncryption x 300000 times: 2058ms
hashing md4WithRSAEncryption x 300000 times: 2161ms
hashing md4WithRSAEncryption x 300000 times: 2120ms
Avg for md4WithRSAEncryption 2143
testing md5
hashing md5 x 300000 times: 2237ms
hashing md5 x 300000 times: 2159ms
hashing md5 x 300000 times: 2177ms
hashing md5 x 300000 times: 2117ms
hashing md5 x 300000 times: 2157ms
Avg for md5 2169.4
testing md5-sha1
hashing md5-sha1 x 300000 times: 2410ms
hashing md5-sha1 x 300000 times: 2415ms
hashing md5-sha1 x 300000 times: 2344ms
hashing md5-sha1 x 300000 times: 2424ms
hashing md5-sha1 x 300000 times: 2382ms
Avg for md5-sha1 2395
testing md5WithRSAEncryption
hashing md5WithRSAEncryption x 300000 times: 2236ms
hashing md5WithRSAEncryption x 300000 times: 2136ms
hashing md5WithRSAEncryption x 300000 times: 2281ms
hashing md5WithRSAEncryption x 300000 times: 2240ms
hashing md5WithRSAEncryption x 300000 times: 2135ms
Avg for md5WithRSAEncryption 2205.6
testing mdc2
hashing mdc2 x 300000 times: 15517ms
hashing mdc2 x 300000 times: 15557ms
hashing mdc2 x 300000 times: 15536ms
hashing mdc2 x 300000 times: 15565ms
hashing mdc2 x 300000 times: 15647ms
Avg for mdc2 15564.4
testing mdc2WithRSA
hashing mdc2WithRSA x 300000 times: 15787ms
hashing mdc2WithRSA x 300000 times: 15611ms
hashing mdc2WithRSA x 300000 times: 16654ms
hashing mdc2WithRSA x 300000 times: 15679ms
hashing mdc2WithRSA x 300000 times: 15645ms
Avg for mdc2WithRSA 15875.2
testing ripemd
hashing ripemd x 300000 times: 2298ms
hashing ripemd x 300000 times: 2338ms
hashing ripemd x 300000 times: 2362ms
hashing ripemd x 300000 times: 2515ms
hashing ripemd x 300000 times: 2517ms
Avg for ripemd 2406
testing ripemd160
hashing ripemd160 x 300000 times: 2273ms
hashing ripemd160 x 300000 times: 2399ms
hashing ripemd160 x 300000 times: 2583ms
hashing ripemd160 x 300000 times: 2487ms
hashing ripemd160 x 300000 times: 2401ms
Avg for ripemd160 2428.6
testing ripemd160WithRSA
hashing ripemd160WithRSA x 300000 times: 2328ms
hashing ripemd160WithRSA x 300000 times: 2326ms
hashing ripemd160WithRSA x 300000 times: 2324ms
hashing ripemd160WithRSA x 300000 times: 2334ms
hashing ripemd160WithRSA x 300000 times: 2294ms
Avg for ripemd160WithRSA 2321.2
testing rmd160
hashing rmd160 x 300000 times: 2281ms
hashing rmd160 x 300000 times: 2322ms
hashing rmd160 x 300000 times: 2411ms
hashing rmd160 x 300000 times: 2327ms
hashing rmd160 x 300000 times: 2385ms
Avg for rmd160 2345.2
testing sha1
hashing sha1 x 300000 times: 1909ms
hashing sha1 x 300000 times: 1922ms
hashing sha1 x 300000 times: 1872ms
hashing sha1 x 300000 times: 1890ms
hashing sha1 x 300000 times: 1957ms
Avg for sha1 1910
testing sha1WithRSAEncryption
hashing sha1WithRSAEncryption x 300000 times: 1979ms
hashing sha1WithRSAEncryption x 300000 times: 1913ms
hashing sha1WithRSAEncryption x 300000 times: 1925ms
hashing sha1WithRSAEncryption x 300000 times: 1934ms
hashing sha1WithRSAEncryption x 300000 times: 1938ms
Avg for sha1WithRSAEncryption 1937.8
testing sha224
hashing sha224 x 300000 times: 2168ms
hashing sha224 x 300000 times: 2217ms
hashing sha224 x 300000 times: 2162ms
hashing sha224 x 300000 times: 2234ms
hashing sha224 x 300000 times: 2271ms
Avg for sha224 2210.4
testing sha224WithRSAEncryption
hashing sha224WithRSAEncryption x 300000 times: 2366ms
hashing sha224WithRSAEncryption x 300000 times: 2339ms
hashing sha224WithRSAEncryption x 300000 times: 2349ms
hashing sha224WithRSAEncryption x 300000 times: 2276ms
hashing sha224WithRSAEncryption x 300000 times: 2236ms
Avg for sha224WithRSAEncryption 2313.2
testing sha256
hashing sha256 x 300000 times: 2150ms
hashing sha256 x 300000 times: 2200ms
hashing sha256 x 300000 times: 2225ms
hashing sha256 x 300000 times: 2247ms
hashing sha256 x 300000 times: 2294ms
Avg for sha256 2223.2
testing sha256WithRSAEncryption
hashing sha256WithRSAEncryption x 300000 times: 2311ms
hashing sha256WithRSAEncryption x 300000 times: 2307ms
hashing sha256WithRSAEncryption x 300000 times: 2291ms
hashing sha256WithRSAEncryption x 300000 times: 2348ms
hashing sha256WithRSAEncryption x 300000 times: 2392ms
Avg for sha256WithRSAEncryption 2329.8
testing sha3-224
hashing sha3-224 x 300000 times: 2402ms
hashing sha3-224 x 300000 times: 2421ms
hashing sha3-224 x 300000 times: 2327ms
hashing sha3-224 x 300000 times: 2334ms
hashing sha3-224 x 300000 times: 2308ms
Avg for sha3-224 2358.4
testing sha3-256
hashing sha3-256 x 300000 times: 2328ms
hashing sha3-256 x 300000 times: 2338ms
hashing sha3-256 x 300000 times: 2368ms
hashing sha3-256 x 300000 times: 2388ms
hashing sha3-256 x 300000 times: 2368ms
Avg for sha3-256 2358
testing sha3-384
hashing sha3-384 x 300000 times: 2472ms
hashing sha3-384 x 300000 times: 2644ms
hashing sha3-384 x 300000 times: 2519ms
hashing sha3-384 x 300000 times: 2550ms
hashing sha3-384 x 300000 times: 2540ms
Avg for sha3-384 2545
testing sha3-512
hashing sha3-512 x 300000 times: 2955ms
hashing sha3-512 x 300000 times: 2967ms
hashing sha3-512 x 300000 times: 2997ms
hashing sha3-512 x 300000 times: 2993ms
hashing sha3-512 x 300000 times: 3027ms
Avg for sha3-512 2987.8
testing sha384
hashing sha384 x 300000 times: 2100ms
hashing sha384 x 300000 times: 2186ms
hashing sha384 x 300000 times: 2109ms
hashing sha384 x 300000 times: 2122ms
hashing sha384 x 300000 times: 2091ms
Avg for sha384 2121.6
testing sha384WithRSAEncryption
hashing sha384WithRSAEncryption x 300000 times: 2167ms
hashing sha384WithRSAEncryption x 300000 times: 2178ms
hashing sha384WithRSAEncryption x 300000 times: 2314ms
hashing sha384WithRSAEncryption x 300000 times: 2178ms
hashing sha384WithRSAEncryption x 300000 times: 2325ms
Avg for sha384WithRSAEncryption 2232.4
testing sha512
hashing sha512 x 300000 times: 2144ms
hashing sha512 x 300000 times: 2172ms
hashing sha512 x 300000 times: 2158ms
hashing sha512 x 300000 times: 2170ms
hashing sha512 x 300000 times: 2215ms
Avg for sha512 2171.8
testing sha512-224
hashing sha512-224 x 300000 times: 2213ms
hashing sha512-224 x 300000 times: 2226ms
hashing sha512-224 x 300000 times: 2215ms
hashing sha512-224 x 300000 times: 2191ms
hashing sha512-224 x 300000 times: 2231ms
Avg for sha512-224 2215.2
testing sha512-224WithRSAEncryption
hashing sha512-224WithRSAEncryption x 300000 times: 2341ms
hashing sha512-224WithRSAEncryption x 300000 times: 2288ms
hashing sha512-224WithRSAEncryption x 300000 times: 2325ms
hashing sha512-224WithRSAEncryption x 300000 times: 2393ms
hashing sha512-224WithRSAEncryption x 300000 times: 2288ms
Avg for sha512-224WithRSAEncryption 2327
testing sha512-256
hashing sha512-256 x 300000 times: 2242ms
hashing sha512-256 x 300000 times: 2168ms
hashing sha512-256 x 300000 times: 2068ms
hashing sha512-256 x 300000 times: 2190ms
hashing sha512-256 x 300000 times: 2185ms
Avg for sha512-256 2170.6
testing sha512-256WithRSAEncryption
hashing sha512-256WithRSAEncryption x 300000 times: 2203ms
hashing sha512-256WithRSAEncryption x 300000 times: 3072ms
hashing sha512-256WithRSAEncryption x 300000 times: 2445ms
hashing sha512-256WithRSAEncryption x 300000 times: 2262ms
hashing sha512-256WithRSAEncryption x 300000 times: 2243ms
Avg for sha512-256WithRSAEncryption 2445
testing sha512WithRSAEncryption
hashing sha512WithRSAEncryption x 300000 times: 2211ms
hashing sha512WithRSAEncryption x 300000 times: 2213ms
hashing sha512WithRSAEncryption x 300000 times: 2185ms
hashing sha512WithRSAEncryption x 300000 times: 2186ms
hashing sha512WithRSAEncryption x 300000 times: 2213ms
Avg for sha512WithRSAEncryption 2201.6
testing shake128
hashing shake128 x 300000 times: 2424ms
hashing shake128 x 300000 times: 2384ms
hashing shake128 x 300000 times: 2386ms
hashing shake128 x 300000 times: 2262ms
hashing shake128 x 300000 times: 2372ms
Avg for shake128 2365.6
testing shake256
hashing shake256 x 300000 times: 2320ms
hashing shake256 x 300000 times: 2399ms
hashing shake256 x 300000 times: 2439ms
hashing shake256 x 300000 times: 2365ms
hashing shake256 x 300000 times: 2405ms
Avg for shake256 2385.6
testing sm3
hashing sm3 x 300000 times: 2786ms
hashing sm3 x 300000 times: 2777ms
hashing sm3 x 300000 times: 2727ms
hashing sm3 x 300000 times: 2697ms
hashing sm3 x 300000 times: 2725ms
Avg for sm3 2742.4
testing sm3WithRSAEncryption
hashing sm3WithRSAEncryption x 300000 times: 2813ms
hashing sm3WithRSAEncryption x 300000 times: 2808ms
hashing sm3WithRSAEncryption x 300000 times: 2779ms
hashing sm3WithRSAEncryption x 300000 times: 2802ms
hashing sm3WithRSAEncryption x 300000 times: 2791ms
Avg for sm3WithRSAEncryption 2798.6
testing ssl3-md5
hashing ssl3-md5 x 300000 times: 2018ms
hashing ssl3-md5 x 300000 times: 1936ms
hashing ssl3-md5 x 300000 times: 2063ms
hashing ssl3-md5 x 300000 times: 2007ms
hashing ssl3-md5 x 300000 times: 2062ms
Avg for ssl3-md5 2017.2
testing ssl3-sha1
hashing ssl3-sha1 x 300000 times: 1927ms
hashing ssl3-sha1 x 300000 times: 1955ms
hashing ssl3-sha1 x 300000 times: 2002ms
hashing ssl3-sha1 x 300000 times: 2035ms
hashing ssl3-sha1 x 300000 times: 1958ms
Avg for ssl3-sha1 1975.4
testing whirlpool
hashing whirlpool x 300000 times: 3136ms
hashing whirlpool x 300000 times: 3053ms
hashing whirlpool x 300000 times: 3065ms
hashing whirlpool x 300000 times: 3071ms
hashing whirlpool x 300000 times: 3110ms
Avg for whirlpool 3087
Top 6:
sha1: 1910
ssl3-sha1: 1975.4
ssl3-md5: 2017.2
blake2b512: 2072.2
md4: 2082.6
RSA-SHA1-2: 2090.8
const crypto = require('crypto');
function measureBlock(blockSize) {
const block = crypto.randomBytes(blockSize);
console.log('block size:', blockSize);
const hashes = crypto.getHashes()
for(let i = 0; i<hashes.length; i++ ) {
let algo = hashes[i];
console.log('testing', algo);
let average = [];
for(let i=j = 0; j<5; j++ ) {
average.push(measureHash(block, algo));
}
console.log('Avg for', algo, average.reduce((a, b) => a + b, 0) / average.length);
}
}
function measureHash(block, hashAlgorithm) {
const iterations = 30e4;
const begin = Date.now();
for (let i = 0; i < iterations; i += 1) {
crypto
.createHash(hashAlgorithm)
.update(block)
.digest();
}
const end = Date.now();
const diff = end - begin;
console.log(` hashing ${hashAlgorithm} x ${iterations} times: ${diff}ms`);
return diff;
}
measureBlock(8192);
measureBlock(4096);
measureBlock(1024);
measureBlock(512);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment