1.第一步,下载并安装sm3扩展
wget https://github.com/luzhuqun/php-sm3/archive/master.zip
unzip master.zip
cd master
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
2.使用方法
<?php
$str = "123456";
$sm3str = sm3($str);
var_dump($sm3str);
?>
输出结果:
string(64) "207cf410532f92a47dee245ce9b11ff71f578ebd763eb3bbea44ebd043d018fb"
网友评论