https://github.com/lizhichao/sm
composer require lizhichao/one-sm
<?php
require __DIR__ . '/vendor/autoload.php';
// 字符串签名
echo \OneSm\Sm3::sign('abc') . PHP_EOL;
echo \OneSm\Sm3::sign(str_repeat("adfas 哈哈哈", 100)) . PHP_EOL;
// 文件签名
echo \OneSm\Sm3::signFile(__FILE__) . PHP_EOL;
php bench.php
结果
openssl:4901d7181a1024b8c0f59b8d3c5c6d96b4b707ad10e8ebc8ece5dc49364a3067
one-sm3:4901d7181a1024b8c0f59b8d3c5c6d96b4b707ad10e8ebc8ece5dc49364a3067
SM3-PHP:4901d7181a1024b8c0f59b8d3c5c6d96b4b707ad10e8ebc8ece5dc49364a3067
openssl time:6.3741207122803ms
one-sm3 time:8.1770420074463ms
SM3-PHP time:1738.5928630829ms
1
shawndev 2021-02-01 17:14:40 +08:00
SM3 什么时候成签名算法了???你确定不是杂凑算法???
|
2
GTim 2021-02-01 17:25:58 +08:00
国米算法延迟这么高
|