Home > Backend Development > PHP Tutorial > About php national secret SM3 signature algorithm

About php national secret SM3 signature algorithm

藏色散人
Release: 2023-04-09 17:56:01
forward
3957 people have browsed it

Recommended: "PHP Video Tutorial"

php National Secret SM3 Signature Algorithm

Code address

github.com/lizhichao/sm

##Installation
composer require lizhichao/one-sm
Copy after login

Use
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;
Copy after login

Performance test

and

openssl , SM3-PHP Performance test

php bench.php
Copy after login

Result

openssl:7ad7adf191f10aeeb0b2c02e083d03c4c675351022b267722c4cc6589c7836e9
one-sm3:7ad7adf191f10aeeb0b2c02e083d03c4c675351022b267722c4cc6589c7836e9SM3-PHP:b7a0c84f86acd90f41f09d791735baf07ddf8acae6349319f5ab71c375fa37cb
openssl time:4.755973815918ms
one-sm3 time:5.5310726165771msSM3-PHP time:708.27698707581ms
Copy after login
Test code bench .php:

https://github.com/lizhichao/sm/blob/master/bench.php

The above is the detailed content of About php national secret SM3 signature algorithm. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template