Posted in PHP onAugust 27, 2017
本文实例讲述了PHP实现的sha1加密功能。分享给大家供大家参考,具体如下:
function encryptTokey($data){ $apikey = 'testapikey111'; $ps1 = sha1($apikey . strtolower($data)); $ps1 = strtoupper($ps1); $s1 = implode(str_split($ps1, 2), '-'); $ps2 = md5($s1 . $apikey); $ps2 = strtoupper($ps2); $token = implode(str_split($ps2, 2), '-'); return $token; } echo encryptTokey('testdata');
运行结果:
68-10-98-74-4C-82-74-4B-CC-49-31-98-46-02-EE-8E
PHP实现的简单sha1加密功能示例
- Author -
wuxing164声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@