以下为引用的内容:
gunzipmcrypt-x.x.x.tar.gz
tar -xvfmcrypt-x.x.x.tar
./configure --disable-posix-threads
make
make install
cd to your PHP directory.
./configure -with-mcrypt=[dir] [--other-configuration-directives]
make
make install
以下为引用的内容:
gunzipmhash-x.x.x.tar.gz
tar -xvfmhash-x.x.x.tar
./configure
make
make install
cd
./configure -with-mhash=[dir] [--other-configuration-directives]
make
make install
以下为引用的内容:
= MHASH_TIGER;
= "These are the directions to the secret fort. Two steps left, three steps right, and cha chacha.";
= mhash(, );
print "The hashed message is ". bin2hex();
?>
执行这一段脚本程序将得到下面的输出结果:作者: jsper 时间: 2008-11-19 10:43 标题: PHP实例:PHP安全编程之加密功能 The hashed message is 07a92a4db3a4177f19ec9034ae5400eb60d1a9fbb4ade461
以下为引用的内容:
= MHASH_TIGER;
print "This data has been hashed with the".mhash_get_hash_name()."hashing algorithm.";
?>
得到的输出是:
This data has been hashed with the TIGER hashing algorithm.
关于PHP和加密最后需要注意的一个问题
关于PHP和加密需要注意的最后的一个重要问题是在服务器和客户端之间传输的数据在传输过程中是不安全的!PHP是一种服务器端技术,不能阻止数据在传输过程中泄密。因此,如果想实现一个完整的安全应用,建议选用Apache-SSL或其他的安全服务器布置。