JAVA下wordpress加密
来源:互联网 发布:手机4g网络测速在线 编辑:程序博客网 时间:2024/06/06 03:04
这个加密找了很久,都只有PHP版本的,同事给了我一个远古的C#版本的,写的太晦涩难懂,而且还有错的,不过最后好歹弄出来的。上代码
//wordpress 加密public String WordpressEncrypt(String str,String salt){MessageDigest md;try {md = MessageDigest.getInstance("MD5");byte[] hash = md.digest((salt + str).getBytes());byte[] palin = str.getBytes();for(int i = 0;i < 8192;i++){byte[] newplain = new byte[hash.length + palin.length];System.arraycopy(hash, 0, newplain, 0, hash.length);System.arraycopy(palin, 0, newplain, hash.length, palin.length);//MD5加密MessageDigest md5 = MessageDigest.getInstance("MD5");hash = md5.digest(newplain);}int[] x = new int[hash.length];for(int i = 0;i < hash.length;i++){x[i] = hash[i] & 0xff;}//System.out.println(re);//return re;return "$P$B" + salt + encode64(x, 16);//return String.valueOf(hash.length);} catch (NoSuchAlgorithmException e) {// TODO Auto-generated catch blocke.printStackTrace();return "fail";}}private String encode64(int[] input, int number){ String hash = ""; int output = 0; int[] input_2 = new int[number]; for (int i = 0; i < number; i++) { input_2[i] = input[i]; //text_2.Text += "'" + input_2[i] + "'" ; } String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int output_2 = 0; int len_2 = 0; int value_2 = 0; for (int i = 0; i <number;i++ ) { int value = input_2[i]; output = input_2[i]; hash += itoa64.substring((value % 64 + 64)%64, (value % 64 + 64)%64 + 1); if (i + 1 <= number) { if (i + 1 < number) { value = input_2[++i]; output_2 = (value << 8);//左移8位 output = output + output_2; } value_2 = output; int len = Integer.toBinaryString(output).length(); if (len - 6 > 0) { output = (output >> 6);//右移6位 } else { output = 0; } value = output; hash += itoa64.substring((value % 64 + 64)%64, (value % 64 + 64)%64 + 1); } else { break; } if (i + 1 < number) { value = input_2[++i]; output_2 = (value << 16);//左移16位 output = value_2 + output_2; value_2 = output; len_2 = Integer.toBinaryString(output).length(); output_2 = output; output = (output >> 12);//右移12位 value = output;// hash += itoa64.substring((value % 64 + 64)%64, (value % 64 + 64)%64 + 1); } else { break; } if (i+1< number) { len_2 = Integer.toBinaryString(output_2).length(); output = (output_2 >> 18);//右移18位 value = output;// hash += itoa64.substring((value % 64 + 64)%64, (value % 64 + 64)%64 + 1); } } return hash; //*/ }
0 0
- JAVA下wordpress加密
- JAVA下AES256加密
- Java下实现MD5加密
- java 下的 des加密/3des加密 示例
- JAVA 下的 pgp加密解密示例
- linux下安装wordpress
- SAE下安装wordpress
- ubuntu下安装wordpress
- linux下搭建wordpress
- debian下安装wordpress
- linux下配置wordpress
- XAMPP和WORDPRESS(下)
- centOS下搭建WordPress
- Linux下安装Wordpress
- Nginx下搭建wordpress
- wordpress用户密码加密原理及其算法分析
- WordPress 开发者工具箱(下)
- WordPress下coolcode插件使用方法
- 第五章:纹理
- JAVA,AES加密算法
- 给初学者,OC知识的简单总结
- oracle 11g不能导出空表的多种解决方法
- eclipse中导入jar包的源码
- JAVA下wordpress加密
- ap0100at_ds移植步骤
- 2012年5月SAT香港真题解析
- cookie实现登陆页面保存用户名
- XMPP协议实现原理介绍
- Volley来实现网络请求
- ROS学习手记13 -- 完成了初级的教程以后
- Swap Nodes in Pairs
- app后台设计总结