User Tools

Site Tools


public:the_performance_of_sha256_and_sha512_algorithms_as_implemented_by_openssl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:the_performance_of_sha256_and_sha512_algorithms_as_implemented_by_openssl [2020/09/21 23:56] fangfufupublic:the_performance_of_sha256_and_sha512_algorithms_as_implemented_by_openssl [2020/09/23 10:36] (current) fangfufu
Line 1: Line 1:
 ====== The performance of SHA256 and SHA512 algorithms as implemented by OpenSSL ====== ====== The performance of SHA256 and SHA512 algorithms as implemented by OpenSSL ======
-https://eprint.iacr.org/2010/548.pdf+SHA256 and SHA512 are both cryptographic hash algorithms. They are used for detecting whether data had been modified. The digest size SHA256 and SHA512 are 256 bit and 512 bit respectively. SHA512 is more resistant to attacks compared to SHA256. However, interestingly enough, under x86-64 architecture, it is faster to compute SHA512 compared to SHA256. The reason is detailed in [[https://eprint.iacr.org/2010/548.pdf|this paper]]. 
 + 
 +Below are the performance metrics from some of the machines I have. If you are not on x86-64, it is faster to use SHA256.  
 <code> <code>
 $ uname -a; grep -m 1 'model name' /proc/cpuinfo; openssl speed -evp sha256 sha512 $ uname -a; grep -m 1 'model name' /proc/cpuinfo; openssl speed -evp sha256 sha512
Line 79: Line 82:
 </code> </code>
  
 +<code> 
 +# uname -a; grep -m 1 'model' /proc/cpuinfo; openssl speed -evp sha256 sha512 
 +Linux windranger 4.9.120 #0 Thu Aug 16 07:51:15 2018 mips GNU/Linux 
 +cpu model               : MIPS 74Kc V4.12 
 +Doing sha512 for 3s on 16 size blocks: 115217 sha512's in 2.91s 
 +Doing sha512 for 3s on 64 size blocks: 114340 sha512's in 2.92s 
 +Doing sha512 for 3s on 256 size blocks: 39213 sha512's in 2.85s 
 +Doing sha512 for 3s on 1024 size blocks: 13437 sha512's in 2.92s 
 +Doing sha512 for 3s on 8192 size blocks: 1866 sha512's in 2.92s 
 +Doing sha256 for 3s on 16 size blocks: 343958 sha256's in 2.93s 
 +Doing sha256 for 3s on 64 size blocks: 236151 sha256's in 2.92s 
 +Doing sha256 for 3s on 256 size blocks: 120511 sha256's in 2.89s 
 +Doing sha256 for 3s on 1024 size blocks: 40789 sha256's in 2.88s 
 +Doing sha256 for 3s on 8192 size blocks: 5696 sha256's in 2.95s 
 +OpenSSL 1.0.2p  14 Aug 2018 
 +built on: reproducible build, date unspecified 
 +options:bn(64,32) rc4(ptr,char) des(idx,cisc,2,long) aes(partial) blowfish(ptr) 
 +compiler: mips-openwrt-linux-musl-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/staging_dir/target-mips_24kc_musl/usr/include -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/staging_dir/target-mips_24kc_musl/include -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/usr/include -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/include/fortify -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/include -znow -zrelro -DOPENSSL_SMALL_FOOTPRINT -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DOPENSSL_NO_ERR -DTERMIOS -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/build_dir/target-mips_24kc_musl/openssl-1.0.2p:openssl-1.0.2p -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -I/build/openwrt-18.06/slaves/phase2/mips_24kc/build/sdk/feeds/base/package/libs/openssl/include -ffunction-sections -fdata-sections -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM 
 +The 'numbers' are in 1000s of bytes per second processed. 
 +type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes 
 +sha256            1878.27k     5175.91k    10675.02k    14502.76k    15817.50k 
 +sha512             633.50k     2506.08k     3522.29k     4712.15k     5235.02k 
 +</code> 
 +<code> 
 +# uname -a; grep -m 1 'model' /proc/cpuinfo; openssl speed -evp sha256 sha512 
 +Linux Aether 4.14.195 #0 SMP Sun Sep 6 16:19:39 2020 mips GNU/Linux 
 +cpu model               : MIPS 34Kc V5.6 
 +Doing sha512 for 3s on 16 size blocks: 88913 sha512's in 2.96s 
 +Doing sha512 for 3s on 64 size blocks: 90304 sha512's in 3.00s 
 +Doing sha512 for 3s on 256 size blocks: 31356 sha512's in 2.99s 
 +Doing sha512 for 3s on 1024 size blocks: 10574 sha512's in 2.99s 
 +Doing sha512 for 3s on 8192 size blocks: 1471 sha512's in 2.99s 
 +Doing sha512 for 3s on 16384 size blocks: 740 sha512's in 3.00s 
 +Doing sha256 for 3s on 16 size blocks: 152011 sha256's in 3.00s 
 +Doing sha256 for 3s on 64 size blocks: 128152 sha256's in 2.99s 
 +Doing sha256 for 3s on 256 size blocks: 76662 sha256's in 3.00s 
 +Doing sha256 for 3s on 1024 size blocks: 29636 sha256's in 2.99s 
 +Doing sha256 for 3s on 8192 size blocks: 4303 sha256's in 2.89s 
 +Doing sha256 for 3s on 16384 size blocks: 2125 sha256's in 2.81s 
 +OpenSSL 1.1.1g  21 Apr 2020 
 +built on: Sat Sep 19 17:48:27 2020 UTC 
 +options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr) 
 +compiler: mips-openwrt-linux-musl-gcc -fPIC -pthread -mabi=32 -Wa,--noexecstack -Wall -O3 -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM -DOPENSSL_SMALL_FOOTPRINT 
 +The 'numbers' are in 1000s of bytes per second processed. 
 +type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes 
 +sha256             810.73k     2743.05k     6541.82k    10149.59k    12197.29k    12390.04k 
 +sha512             480.61k     1926.49k     2684.66k     3621.33k     4030.24k     4041.39k 
 +</code>
public/the_performance_of_sha256_and_sha512_algorithms_as_implemented_by_openssl.1600732587.txt.gz · Last modified: 2020/09/21 23:56 by fangfufu