超强php加解密扩展:cryptopp

WBOY
Release: 2016-06-23 13:43:05
Original
1154 people have browsed it

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



除了encode和decode方法之外,没有任何需要特别说明,方法名一目了然.


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



其他静态方法的使用就更简单了,这样就OK了:

$str = "1234567890";cryptopp::md5($str);cryptopp::sha1($str);cryptopp::sha256($str);....
Copy after login



下载地址:https://drive.google.com/file/d/0B2RkHfVa7EtzSWItWkFIV2FPbGM/view?usp=sharing

cryptopp扩展在64位ubuntu上编译使用,不适合32位系统.暂未提供32位版本。windows 不可用。能否用于其他64位linux系统,未测试,未知。

source:php.cn
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