2LVUzyYywMFYVVJrPbr4pA==这个字符串是经过MD5和BASE64加密后的结果,哪位高人能帮我解密到最初的字符串
加密规则:BASE64(MD5(***)) String srcDeviceId = "231211050002";
String userIdType = "1";
String userId = "008645189635660";
String spId = "008645189635660";
BigInteger PIDType = new BigInteger("0");
String PID = "90120111142030000037522";
String timeStamp = "2008-09-25T09:30:47.0Z";
try {
String authenticator = Base64.encode(Md5.MD5Encode(
srcDeviceId + userIdType + userId + spId + PIDType + PID
+ timeStamp + "12345678").getBytes());
System.out.println(authenticator);
} catch (Exception ex) {
}我这样加密出来后的结果是:M2UxYWQ2NTZmZDQ3ZDAxNTUyMThjYTM4MGRkYWNiNzQ=
加密规则:BASE64(MD5(***)) String srcDeviceId = "231211050002";
String userIdType = "1";
String userId = "008645189635660";
String spId = "008645189635660";
BigInteger PIDType = new BigInteger("0");
String PID = "90120111142030000037522";
String timeStamp = "2008-09-25T09:30:47.0Z";
try {
String authenticator = Base64.encode(Md5.MD5Encode(
srcDeviceId + userIdType + userId + spId + PIDType + PID
+ timeStamp + "12345678").getBytes());
System.out.println(authenticator);
} catch (Exception ex) {
}我这样加密出来后的结果是:M2UxYWQ2NTZmZDQ3ZDAxNTUyMThjYTM4MGRkYWNiNzQ=
String srcDeviceId = "231211050002";
String userIdType = "1";
String userId = "008645189635660";
String spId = "008645189635660";
BigInteger PIDType = new BigInteger("0");
String PID = "90120111142030000037522";
String timeStamp = "2008-09-25T09:30:47.0Z";
String password = "12345678";
先用MD5加密,然后再用BASE64加密后结果为:2LVUzyYywMFYVVJrPbr4pA==
小弟不剩感激,谢谢啦!!!
请贴MD5和BASE64源码!
String srcDeviceId = "231211050002";
String userIdType = "1";
String userId = "008645189635660";
String spId = "008645189635660";
BigInteger PIDType = new BigInteger("0");
String PID = "90120111142030000037522";
String timeStamp = "2008-09-25T09:30:47.0Z";
String password = "12345678"; String[] inputs = new String[]{srcDeviceId, userIdType, userId, spId, PIDType.toString(), PID, timeStamp, password}; permutation(inputs, 0, inputs.length); } private static void permutation(String[] inputs, int m, int n)
{
int i;
String t;
if (m<n-1)
{
permutation(inputs, m+1, n);
for (i=m+1;i<n;i++) {
t=inputs[m];
inputs[m]=inputs[i];
inputs[i]=t;
permutation(inputs, m+1, n);
t=inputs[m];
inputs[m]=inputs[i];
inputs[i]=t;
}
}
else
{
String value = "";
for(String input : inputs) {
value += input;
}
String authenticator = Base64.encode(MD5.MD5Encode(value).getBytes());
if ("2LVUzyYywMFYVVJrPbr4pA==".equals(authenticator)) {
System.out.println("Found...");
System.out.println(inputs);
System.exit(0);
}
}
}
如果参数没错的话,那运行一下就能找到正确的参数组合。
可以用dsc或者asc
import java.io.IOException;
import java.security.MessageDigest;import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;/**
* 本类提供通用的安全算法
* @author
*/
public class SecurityArithmetic {
public final static byte[] md5(String s) {
byte[] md=null;
try {
byte[] btInput = s.getBytes();
MessageDigest mdInst = MessageDigest.getInstance("MD5");
mdInst.update(btInput);
md = mdInst.digest();
}
catch (Exception e) {
// e.printStackTrace();
return null;
}
return md;
}
public static String base64Encode(byte[] b){
return new BASE64Encoder().encode(b);
} public static byte[] base64Decode(String b){
try {
return new BASE64Decoder().decodeBuffer(b);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
public static String md5AndHex(String s){
byte[] b=md5(s);
String temp="";
for (int i=0;i<b.length;i++){
temp+=StringUtils.pad(Integer.toHexString(b[i] & 0xff), 2, '0', true);
}
return temp;
}
public static String md5AndBase64(String s){
return base64Encode(md5(s));
}
/**
* @param args
*/
public static void main(String[] args) {
//d41d8cd98f00b204e9800998ecf8427e
//d41d8cd98f00b204e9800998ecf8427e
System.out.println(md5AndBase64("XXX"));
System.out.println(md5AndHex(""));
}}
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;public class Md5 {
public String comuteDigest(String name){
MessageDigest messageDigest;
byte[] name_b =name.getBytes();
String newName="";
try{
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();//重置摘要
messageDigest.update(name_b);//更新摘要
byte[] hash = messageDigest.digest();//计算摘要
for(int i = 0;i<hash.length;i++){
int v = hash[i] & 0xFF;//转换为十六进制
if(v < 16)
newName += "0";
newName += Integer.toString(v,16).toUpperCase();
}
}
catch(NoSuchAlgorithmException e){
System.out.println(e);
}
return newName;
}
public static void main(String[] args){
Md5 t=new Md5();
System.out.println(t.comuteDigest("sss"));
}
}
BASE64是一種字符串編碼格式...方便網上傳輸
MD5是一種信息摘要,message digest(hash),理論上存在若干個hash值相同的東西,但若要從摘要值逆運算取得原東西是計算上不可逆的,所以message digest是單方向的...
简单地说,碰撞就是不同的字符串生成了相同的摘要信息。
MD5不可以。
Java没有这种接口。