博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java wordpress密码加密
阅读量:7073 次
发布时间:2019-06-28

本文共 2476 字,大约阅读时间需要 8 分钟。

  hot3.png

java wordpress密码加密

(1)wordpress密码加密后的密文格式: 

$P$B12345678huiyw4r7qhfuhs8yjmd6ef 
$P$912345678huiyw4r7qhfuhs8yjmd6ef 
第一段:$P$格式固定 
第二段:只有一个字符。若php版本大于5.0则为B,否则为9 
第三段:8位salt 
第四段:22位,真正加密后的密码 
(2)密文的加密方法 
php版本高于5.0 

$hash = md5($salt . $password, TRUE);    do    {      $hash = md5($hash . $password, TRUE);    } while (--$count);

[注]“.”在php中是连接运算 

参数TRUR表示加密结果取16位二进制 
count取2的13次方:8192 
php版本低于5.0 

$hash = pack('H*', md5($salt . $password));    do     {      $hash = pack('H*', md5($hash . $password));    } while (--$count);

[注]php低于5.0 md5返回的是32位十六进制字符串形式 

pack(H*) 将md5结果转化为二进制 
count取2的11次方:2048 
上述方法得到的 $hash 再进行base64加密: 
(3)wordpress的base64算法 
64位字符表比较特殊,与普通的字符表顺序有差异: 
itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 
//input即hash,count=16 

String  (String strString salt){    MessageDigest md{        md = MessageDigest.()[] hash = md.digest((salt + str).getBytes())[] palin = str.getBytes()(i = i < i++){            [] newplain = [hash.+ palin.]System.(hashnewplainhash.)System.(palinnewplainhash.palin.)MessageDigest md5 = MessageDigest.()hash = md5.digest(newplain)}        [] x = [hash.](i = i < hash.i++){            x[i] = hash[i] & }        + salt + (x)} (NoSuchAlgorithmException e) {        e.printStackTrace()}}String ([] inputnumber){    String hash = output = [] input_2 = [number](i = i < numberi++)    {        input_2[i] = input[i]}    String itoa64 = output_2 = len_2 = value_2 = (i = i 
<= number)        {            (i + < number)            {                value = input_2[++i]output_2 = (value << )output = output + output_2}            value_2 = outputlen = Integer.(output).length()(len - > )            {                output = (output >> )}            {                output = }            value = outputhash += itoa64.substring((value % + )%(value % + )%+ )}        {            }        (i + < number)        {            value = input_2[++i]output_2 = (value << )output = value_2 + output_2value_2 = outputlen_2 = Integer.(output).length()output_2 = outputoutput = (output >> )value = outputhash += itoa64.substring((value % + )%(value % + )%+ )}        {            }        (i+< number)        {            len_2 = Integer.(output_2).length()output = (output_2 >> )value = outputhash += itoa64.substring((value % + )%(value % + )%+ )}    }    hash}        //调用    Utils.WordpressEncrypt(pwd, member_db.getUserPass().substring(4,12)).equals(member_db.getUserPass())

转载于:https://my.oschina.net/pizazz/blog/626006

你可能感兴趣的文章
Struts2自己定义拦截器实例—登陆权限验证
查看>>
调用webservice查询手机号码归属地信息
查看>>
RESTFul basic introduction
查看>>
NoSQL数据库的分布式模型
查看>>
Win7下同时使用有线和无线时的优先级设置
查看>>
Python文件遍历二种方法
查看>>
GUN 的汇编语法
查看>>
java.lang.VerifyError: Inconsistent stackmap frames at branch target
查看>>
sqlite 判断表中是否包含 某个字段
查看>>
freemarker序列的拆分
查看>>
angularjs基本执行流程
查看>>
线段树 + 区间更新: HDU 4893 Wow! Such Sequence!
查看>>
再探vim经常使用命令
查看>>
[BZOJ 1066][SCOI2007]蜥蜴
查看>>
platform_device与platform_driver
查看>>
sql中update,alter,modify,delete,drop的区别和使用(整理)(转)
查看>>
Enabling Active Directory Authentication for VMWare Server running on Linux《转载》
查看>>
MySql性能优化相关
查看>>
Android学习笔记——Intents 和 Intent Filters(二)
查看>>
收藏的Android很好用的组件或者框架。
查看>>