Heim >Backend-Entwicklung >PHP-Tutorial >超强php加解密扩展:cryptopp
cryptopp是一个用c++编写的超强加解密扩展.性能优异可靠.完全可以替换所有PHP编写的加解密类.不仅如此,它的提供的编程接口非常简明易用,可说是PHP程序员必备扩展.
cryptopp扩展的接口如下:
class cryptopp { public function __construct($param); public function setkey($param); public function encode($param); public function decode($param); public static function enhex($param); public static function dehex($param); public static function enbase64($param); public static function debase64($param); public static function enbase32($param); public static function debase32($param); public static function md5($param); public static function sha1($param); public static function sha256($param); public static function sha512($param);}
encode/decode分别对应于AES加解密.
使用方法很简单:
$key = "key";$cryptopp = new cryptopp($key);$str = "1234567890";$tmp = $cryptopp->encode($str);header('content-type:text/html;charset=utf-8');echo $str.'<br />';echo $tmp.'<br />';echo $cryptopp->decode($tmp);
$str = "1234567890";cryptopp::md5($str);cryptopp::sha1($str);cryptopp::sha256($str);....
下载地址:https://drive.google.com/file/d/0B2RkHfVa7EtzSWItWkFIV2FPbGM/view?usp=sharing
cryptopp扩展在64位ubuntu上编译使用,不适合32位系统.暂未提供32位版本。windows 不可用。能否用于其他64位linux系统,未测试,未知。