benchmark:多算法性能测试工具,支持哈希、对称加密与非对称加密算法

已归档

benchmark项目提供openHiTLS密码库算法性能测试框架,支持测试对称、非对称、哈希、消息验证码等类型算法测试

分支1Tags0
文件最后提交记录最后更新时间
1 年前
1 年前
1 年前

#speed ####介绍

  • 本程序对openHiTLS库中提供的算法进行性能测试。

####已支持的算法

  • MD5
  • SHA1
  • SHA224
  • SHA256
  • SHA384
  • SHA512
  • SHA3_224
  • SHA3_256
  • SHA3_384
  • SHA3_512
  • SHAKE128
  • SHAKE256
  • SM3
  • AES128_CBC
  • AES192_CBC
  • AES256_CBC
  • AES128_GCM
  • AES192_GCM
  • AES256_GCM
  • SM4_CBC
  • SM4_GCM
  • RSA
  • SM2

####依赖库

  • 本程序使用了libboundscheck库中提供的相关安全函数。

####编译说明 使用时需要指定交叉编译链路径和头文件、库文件路径

例子如下:

make CC=gcc CFLAG="-I/opt/openhitls-dev/include/bsl -I/opt/openhitls-dev/include/crypto/" LD_FLAG="-L/opt/openhitls-dev/build -lboundscheck /opt/openhitls-dev/build/libhitls_bsl.a /opt/openhitls-dev/build/libhitls_crypto.a"

####运行说明 编译后在当前目录下会产生speed程序。

  • 显示帮助信息,运行命令行:
./speed -help

会显示命令行支持的参数及算法信息:

参数:
 -help                          输出帮助信息
 -s                             运行性能测试的时间(1-9999)
 -b                             运行性能测试的自定义包大小
支持的算法:
                 MD5                SHA1              SHA224              SHA256
              SHA384              SHA512            SHA3_224            SHA3_256
            SHA3_384            SHA3_512            SHAKE128            SHAKE256
                 SM3          AES128_CBC          AES192_CBC          AES256_CBC
          AES128_GCM          AES192_GCM          AES256_GCM             SM4_CBC
             SM4_GCM                 RSA                 SM2
  • 进行性能测试,运行命令行:
./speed

命令执行输出各算法的测试运行情况和结果,例如:

Doing MD5 ops for 3s on 16 size blocks: 4864301 MD5 ops in 2.98s
Doing MD5 ops for 3s on 64 size blocks: 3246048 MD5 ops in 2.99s
Doing MD5 ops for 3s on 256 size blocks: 1598484 MD5 ops in 2.99s
Doing MD5 ops for 3s on 1024 size blocks: 529905 MD5 ops in 2.99s
Doing MD5 ops for 3s on 8192 size blocks: 73153 MD5 ops in 3.00s
Doing MD5 ops for 3s on 16384 size blocks: 36858 MD5 ops in 3.00s
Doing SHA1 ops for 3s on 16 size blocks: 4439384 SHA1 ops in 2.99s
Doing SHA1 ops for 3s on 64 size blocks: 3049640 SHA1 ops in 3.00s
Doing SHA1 ops for 3s on 256 size blocks: 1533226 SHA1 ops in 2.99s
Doing SHA1 ops for 3s on 1024 size blocks: 510219 SHA1 ops in 2.99s
Doing SHA1 ops for 3s on 8192 size blocks: 71018 SHA1 ops in 3.00s
Doing SHA1 ops for 3s on 16384 size blocks: 35759 SHA1 ops in 2.99s
Doing SHA224 ops for 3s on 16 size blocks: 2332287 SHA224 ops in 2.99s
Doing SHA224 ops for 3s on 64 size blocks: 1350243 SHA224 ops in 2.89s
Doing SHA224 ops for 3s on 256 size blocks: 636411 SHA224 ops in 2.99s
Doing SHA224 ops for 3s on 1024 size blocks: 199904 SHA224 ops in 3.00s
Doing SHA224 ops for 3s on 8192 size blocks: 27064 SHA224 ops in 2.99s
Doing SHA224 ops for 3s on 16384 size blocks: 13595 SHA224 ops in 3.00s
Doing SHA256 ops for 3s on 16 size blocks: 2317618 SHA256 ops in 2.99s
Doing SHA256 ops for 3s on 64 size blocks: 1399447 SHA256 ops in 3.00s
Doing SHA256 ops for 3s on 256 size blocks: 634191 SHA256 ops in 3.00s
Doing SHA256 ops for 3s on 1024 size blocks: 199800 SHA256 ops in 3.00s
Doing SHA256 ops for 3s on 8192 size blocks: 27049 SHA256 ops in 2.99s
Doing SHA256 ops for 3s on 16384 size blocks: 13538 SHA256 ops in 2.98s
Doing SHA384 ops for 3s on 16 size blocks: 2357054 SHA384 ops in 2.99s
Doing SHA384 ops for 3s on 64 size blocks: 2365616 SHA384 ops in 3.00s
Doing SHA384 ops for 3s on 256 size blocks: 1007474 SHA384 ops in 2.99s
Doing SHA384 ops for 3s on 1024 size blocks: 365696 SHA384 ops in 2.97s
Doing SHA384 ops for 3s on 8192 size blocks: 52014 SHA384 ops in 2.92s
Doing SHA384 ops for 3s on 16384 size blocks: 27001 SHA384 ops in 3.00s
Doing SHA512 ops for 3s on 16 size blocks: 2338268 SHA512 ops in 2.99s
Doing SHA512 ops for 3s on 64 size blocks: 2336381 SHA512 ops in 3.00s
Doing SHA512 ops for 3s on 256 size blocks: 1002580 SHA512 ops in 3.00s
Doing SHA512 ops for 3s on 1024 size blocks: 359204 SHA512 ops in 2.92s
Doing SHA512 ops for 3s on 8192 size blocks: 53380 SHA512 ops in 3.00s
Doing SHA512 ops for 3s on 16384 size blocks: 26924 SHA512 ops in 2.99s
Doing SHA3_224 ops for 3s on 16 size blocks: 1104862 SHA3_224 ops in 2.99s
Doing SHA3_224 ops for 3s on 64 size blocks: 1102423 SHA3_224 ops in 2.99s
Doing SHA3_224 ops for 3s on 256 size blocks: 605732 SHA3_224 ops in 2.93s
Doing SHA3_224 ops for 3s on 1024 size blocks: 171181 SHA3_224 ops in 2.98s
Doing SHA3_224 ops for 3s on 8192 size blocks: 24899 SHA3_224 ops in 3.00s
Doing SHA3_224 ops for 3s on 16384 size blocks: 12491 SHA3_224 ops in 2.99s
Doing SHA3_256 ops for 3s on 16 size blocks: 1113701 SHA3_256 ops in 3.00s
Doing SHA3_256 ops for 3s on 64 size blocks: 1108263 SHA3_256 ops in 2.99s
Doing SHA3_256 ops for 3s on 256 size blocks: 624784 SHA3_256 ops in 2.99s
Doing SHA3_256 ops for 3s on 1024 size blocks: 172869 SHA3_256 ops in 3.00s
Doing SHA3_256 ops for 3s on 8192 size blocks: 23393 SHA3_256 ops in 3.00s
Doing SHA3_256 ops for 3s on 16384 size blocks: 11819 SHA3_256 ops in 2.99s
Doing SHA3_384 ops for 3s on 16 size blocks: 1114566 SHA3_384 ops in 2.94s
Doing SHA3_384 ops for 3s on 64 size blocks: 1136055 SHA3_384 ops in 3.00s
Doing SHA3_384 ops for 3s on 256 size blocks: 442618 SHA3_384 ops in 2.99s
Doing SHA3_384 ops for 3s on 1024 size blocks: 140755 SHA3_384 ops in 2.99s
Doing SHA3_384 ops for 3s on 8192 size blocks: 18338 SHA3_384 ops in 3.00s
Doing SHA3_384 ops for 3s on 16384 size blocks: 8905 SHA3_384 ops in 2.91s
Doing SHA3_512 ops for 3s on 16 size blocks: 1179232 SHA3_512 ops in 3.00s
Doing SHA3_512 ops for 3s on 64 size blocks: 1165261 SHA3_512 ops in 2.97s
Doing SHA3_512 ops for 3s on 256 size blocks: 345742 SHA3_512 ops in 2.97s
Doing SHA3_512 ops for 3s on 1024 size blocks: 97449 SHA3_512 ops in 3.00s
Doing SHA3_512 ops for 3s on 8192 size blocks: 12946 SHA3_512 ops in 2.98s
Doing SHA3_512 ops for 3s on 16384 size blocks: 6517 SHA3_512 ops in 3.00s
Doing SHAKE128 ops for 3s on 16 size blocks: 1081063 SHAKE128 ops in 3.00s
Doing SHAKE128 ops for 3s on 64 size blocks: 1079354 SHAKE128 ops in 2.99s
Doing SHAKE128 ops for 3s on 256 size blocks: 611187 SHAKE128 ops in 3.00s
Doing SHAKE128 ops for 3s on 1024 size blocks: 192623 SHAKE128 ops in 2.99s
Doing SHAKE128 ops for 3s on 8192 size blocks: 28628 SHAKE128 ops in 3.00s
Doing SHAKE128 ops for 3s on 16384 size blocks: 14349 SHAKE128 ops in 3.00s
Doing SHAKE256 ops for 3s on 16 size blocks: 1112362 SHAKE256 ops in 2.99s
Doing SHAKE256 ops for 3s on 64 size blocks: 1112512 SHAKE256 ops in 3.00s
Doing SHAKE256 ops for 3s on 256 size blocks: 612389 SHAKE256 ops in 2.95s
Doing SHAKE256 ops for 3s on 1024 size blocks: 172674 SHAKE256 ops in 2.99s
Doing SHAKE256 ops for 3s on 8192 size blocks: 23375 SHAKE256 ops in 2.99s
Doing SHAKE256 ops for 3s on 16384 size blocks: 11790 SHAKE256 ops in 2.99s
Doing SM3 ops for 3s on 16 size blocks: 2537642 SM3 ops in 3.00s
Doing SM3 ops for 3s on 64 size blocks: 1426826 SM3 ops in 2.84s
Doing SM3 ops for 3s on 256 size blocks: 678369 SM3 ops in 2.99s
Doing SM3 ops for 3s on 1024 size blocks: 211637 SM3 ops in 2.99s
Doing SM3 ops for 3s on 8192 size blocks: 28595 SM3 ops in 3.00s
Doing SM3 ops for 3s on 16384 size blocks: 14392 SM3 ops in 3.00s
Doing AES128_CBC ops for 3s on 16 size blocks: 7305807 AES128_CBC ops in 2.98s
Doing AES128_CBC ops for 3s on 64 size blocks: 2601705 AES128_CBC ops in 3.00s
Doing AES128_CBC ops for 3s on 256 size blocks: 731930 AES128_CBC ops in 2.98s
Doing AES128_CBC ops for 3s on 1024 size blocks: 189221 AES128_CBC ops in 2.99s
Doing AES128_CBC ops for 3s on 8192 size blocks: 23886 AES128_CBC ops in 3.00s
Doing AES128_CBC ops for 3s on 16384 size blocks: 11706 AES128_CBC ops in 2.95s
Doing AES192_CBC ops for 3s on 16 size blocks: 6661754 AES192_CBC ops in 2.99s
Doing AES192_CBC ops for 3s on 64 size blocks: 2262407 AES192_CBC ops in 2.99s
Doing AES192_CBC ops for 3s on 256 size blocks: 629867 AES192_CBC ops in 3.00s
Doing AES192_CBC ops for 3s on 1024 size blocks: 161908 AES192_CBC ops in 3.00s
Doing AES192_CBC ops for 3s on 8192 size blocks: 20189 AES192_CBC ops in 2.97s
Doing AES192_CBC ops for 3s on 16384 size blocks: 10171 AES192_CBC ops in 2.99s
Doing AES256_CBC ops for 3s on 16 size blocks: 6132127 AES256_CBC ops in 3.00s
Doing AES256_CBC ops for 3s on 64 size blocks: 2025392 AES256_CBC ops in 2.99s
Doing AES256_CBC ops for 3s on 256 size blocks: 555076 AES256_CBC ops in 3.00s
Doing AES256_CBC ops for 3s on 1024 size blocks: 139499 AES256_CBC ops in 2.94s
Doing AES256_CBC ops for 3s on 8192 size blocks: 17902 AES256_CBC ops in 3.00s
Doing AES256_CBC ops for 3s on 16384 size blocks: 8911 AES256_CBC ops in 3.00s
Doing AES128_GCM ops for 3s on 16 size blocks: 7283264 AES128_GCM ops in 2.99s
Doing AES128_GCM ops for 3s on 64 size blocks: 2541563 AES128_GCM ops in 3.00s
Doing AES128_GCM ops for 3s on 256 size blocks: 695686 AES128_GCM ops in 2.95s
Doing AES128_GCM ops for 3s on 1024 size blocks: 180065 AES128_GCM ops in 2.97s
Doing AES128_GCM ops for 3s on 8192 size blocks: 22890 AES128_GCM ops in 2.99s
Doing AES128_GCM ops for 3s on 16384 size blocks: 11429 AES128_GCM ops in 2.99s
Doing AES192_GCM ops for 3s on 16 size blocks: 6630383 AES192_GCM ops in 3.00s
Doing AES192_GCM ops for 3s on 64 size blocks: 2203086 AES192_GCM ops in 2.97s
Doing AES192_GCM ops for 3s on 256 size blocks: 607838 AES192_GCM ops in 2.99s
Doing AES192_GCM ops for 3s on 1024 size blocks: 156391 AES192_GCM ops in 3.00s
Doing AES192_GCM ops for 3s on 8192 size blocks: 19704 AES192_GCM ops in 2.99s
Doing AES192_GCM ops for 3s on 16384 size blocks: 9839 AES192_GCM ops in 3.00s
Doing AES256_GCM ops for 3s on 16 size blocks: 5955990 AES256_GCM ops in 2.94s
Doing AES256_GCM ops for 3s on 64 size blocks: 1980445 AES256_GCM ops in 2.99s
Doing AES256_GCM ops for 3s on 256 size blocks: 538345 AES256_GCM ops in 3.00s
Doing AES256_GCM ops for 3s on 1024 size blocks: 137920 AES256_GCM ops in 2.99s
Doing AES256_GCM ops for 3s on 8192 size blocks: 17352 AES256_GCM ops in 2.99s
Doing AES256_GCM ops for 3s on 16384 size blocks: 8556 AES256_GCM ops in 2.97s
Doing SM4_CBC ops for 3s on 16 size blocks: 4834325 SM4_CBC ops in 3.00s
Doing SM4_CBC ops for 3s on 64 size blocks: 1450308 SM4_CBC ops in 2.99s
Doing SM4_CBC ops for 3s on 256 size blocks: 379038 SM4_CBC ops in 2.98s
Doing SM4_CBC ops for 3s on 1024 size blocks: 96800 SM4_CBC ops in 3.00s
Doing SM4_CBC ops for 3s on 8192 size blocks: 12065 SM4_CBC ops in 2.98s
Doing SM4_CBC ops for 3s on 16384 size blocks: 5912 SM4_CBC ops in 2.93s
Doing SM4_GCM ops for 3s on 16 size blocks: 4630841 SM4_GCM ops in 2.99s
Doing SM4_GCM ops for 3s on 64 size blocks: 2939444 SM4_GCM ops in 3.00s
Doing SM4_GCM ops for 3s on 256 size blocks: 947291 SM4_GCM ops in 3.00s
Doing SM4_GCM ops for 3s on 1024 size blocks: 246477 SM4_GCM ops in 2.99s
Doing SM4_GCM ops for 3s on 8192 size blocks: 31194 SM4_GCM ops in 3.00s
Doing SM4_GCM ops for 3s on 16384 size blocks: 15556 SM4_GCM ops in 3.00s
RSA not support 512 bits
Doing 1024 bits gen RSA ops for 3s: 39 1024 bits RSA gen ops in 3.02s
Doing 1024 bits sign RSA ops for 3s: 3430 1024 bits RSA sign ops in 2.99s
Doing 1024 bits sign RSA ops for 3s: 51053 1024 bits RSA verify ops in 2.99s
Doing 2048 bits gen RSA ops for 3s: 5 2048 bits RSA gen ops in 3.22s
Doing 2048 bits sign RSA ops for 3s: 491 2048 bits RSA sign ops in 3.00s
Doing 2048 bits sign RSA ops for 3s: 16157 2048 bits RSA verify ops in 3.00s
Doing 3072 bits gen RSA ops for 3s: 2 3072 bits RSA gen ops in 3.75s
Doing 3072 bits sign RSA ops for 3s: 155 3072 bits RSA sign ops in 3.00s
Doing 3072 bits sign RSA ops for 3s: 7628 3072 bits RSA verify ops in 3.00s
Doing 4096 bits gen RSA ops for 3s: 1 4096 bits RSA gen ops in 9.65s
Doing 4096 bits sign RSA ops for 3s: 67 4096 bits RSA sign ops in 2.98s
Doing 4096 bits sign RSA ops for 3s: 4380 4096 bits RSA verify ops in 3.00s
Doing 512 bits gen SM2 ops for 3s: 7758 512 bits SM2 gen ops in 2.99s
Doing 512 bits sign SM2 ops for 3s: 4734 512 bits SM2 sign ops in 3.00s
Doing 512 bits sign SM2 ops for 3s: 1448 512 bits SM2 verify ops in 2.95s
Doing 512 bits encrypt SM2 ops for 3s: 3135 512 bits SM2 sign ops in 2.99s
Doing 512 bits decrypt SM2 ops for 3s: 5414 512 bits SM2 sign ops in 3.00s
加解密算法结果如下:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
MD5              26117.05k    69480.63k   136860.17k   181479.17k   199756.46k   201293.82k
SHA1             23755.90k    65058.99k   131272.86k   174737.21k   193926.49k   195944.97k
SHA224           12480.47k    29901.58k    54488.70k    68233.90k    74149.93k    74246.83k
SHA256           12401.97k    29854.87k    54117.63k    68198.40k    74108.83k    74431.74k
SHA384           12613.00k    50466.47k    86258.64k   126085.09k   145924.21k   147461.46k
SHA512           12512.47k    49842.79k    85553.49k   125967.43k   145762.99k   147532.71k
SHA3_224          5912.31k    23597.01k    52924.02k    58821.93k    67990.87k    68445.67k
SHA3_256          5939.74k    23722.02k    53493.21k    59005.95k    63878.49k    64763.38k
SHA3_384          6065.67k    24235.84k    37896.39k    48205.06k    50074.97k    50137.29k
SHA3_512          6289.24k    25110.00k    29801.33k    33262.59k    35588.47k    35591.51k
SHAKE128          5765.67k    23103.23k    52154.62k    65968.55k    78173.53k    78364.67k
SHAKE256          5952.44k    23733.59k    53142.91k    59136.51k    64042.81k    64604.47k
SM3              13534.09k    32153.83k    58081.09k    72480.36k    78083.41k    78599.51k
AES128_CBC       39225.81k    55503.04k    62877.21k    64803.45k    65224.70k    65013.93k
AES192_CBC       35648.18k    48426.10k    53748.65k    55264.60k    55686.29k    55733.00k
AES256_CBC       32704.68k    43352.87k    47366.49k    48587.41k    48884.39k    48665.94k
AES128_GCM       38973.99k    54220.01k    60371.40k    62083.02k    62714.01k    62626.33k
AES192_GCM       35362.04k    47473.91k    52042.32k    53381.46k    53985.01k    53734.06k
AES256_GCM       32413.55k    42390.80k    45938.77k    47234.14k    47541.00k    47199.16k
SM4_CBC          25783.07k    31043.38k    32561.65k    33041.07k    33166.60k    33058.77k
SM4_GCM          24780.42k    62708.14k    80835.50k    84412.19k    85180.42k    84956.50k



            bits    gen          sign      verify    encrypt    decrypt
RSA     512 bits     0.00/s     0.00/s     0.00/s
RSA    1024 bits    12.91/s  1147.16/s 17074.58/s
RSA    2048 bits     1.55/s   163.67/s  5385.67/s
RSA    3072 bits     0.53/s    51.67/s  2542.67/s
RSA    4096 bits     0.10/s    22.48/s  1460.00/s
SM2     512 bits  2594.65/s  1578.00/s   490.85/s    33.55k     57.75k

项目介绍

benchmark项目提供openHiTLS密码库算法性能测试框架,支持测试对称、非对称、哈希、消息验证码等类型算法测试

定制我的领域