12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- require __DIR__ . '/vendor/autoload.php';
- $str = file_get_contents(__FILE__);
- $t = microtime(true);
- echo 'openssl:' . trim(str_replace('(stdin)=', '', exec('cat ' . __FILE__ . ' | openssl dgst -SM3'))) . PHP_EOL;;
- $t1 = microtime(true);
- echo 'one-sm3:' . (new \OneSm\Sm3)->sign($str) . PHP_EOL;
- $t2 = microtime(true);
- echo 'SM3-PHP:' . sm3($str) . PHP_EOL;
- $t3 = microtime(true);
- echo 'openssl time:'.($t1 - $t) * 1000 . 'ms' . PHP_EOL;
- echo 'one-sm3 time:'.($t2 - $t1) * 1000 . 'ms' . PHP_EOL;
- echo 'SM3-PHP time:'.($t3 - $t2) * 1000 . 'ms' . PHP_EOL;
|