项目中有时我们需要使用PHP将特定的信息进行加密,也就是通过加密算法生成一个加密字符串,这个加密后的字符串可以通过解密算法进行解密,便于程序对解密后的信息进行处理。
最常见的应用在用户登录以及一些API数据交换的场景。
笔者收录了一些比较经典的PHP加密解密函数代码,分享给大家。加密解密原理一般都是通过一定的加密解密算法,将密钥加入到算法中,最终得到加密解密结果。
[b]1、非常给力的authcode加密函数,Discuz!经典代码(带详解):
[/b]
[url=http://tools.jb51.net/password/CreateMD5Password]http://tools.jb51.net/password/CreateMD5Password[/url]
[b]Escape加密/解密工具:[/b][url=http://tools.jb51.net/password/escapepwd]http://tools.jb51.net/password/escapepwd[/url]
[b]在线SHA1加密工具:[/b][url=http://tools.jb51.net/password/sha1encode]http://tools.jb51.net/password/sha1encode[/url]
[b]短链(短网址)在线生成工具:[/b][url=http://tools.jb51.net/password/dwzcreate]http://tools.jb51.net/password/dwzcreate[/url]
[b]短链(短网址)在线还原工具:[/b][url=http://tools.jb51.net/password/unshorturl]http://tools.jb51.net/password/unshorturl[/url]
[b]高强度密码生成器:[/b][url=http://tools.jb51.net/password/CreateStrongPassword]http://tools.jb51.net/password/CreateStrongPassword[/url]