求救!!BASE64(MD5)加密、解密问题!~

nx350528980 2009-01-12 11:16:55
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=
...全文
1017 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
summily 2009-01-17
  • 打赏
  • 举报
回复
小弟 MD5
不能解密的
startstartsvip 2009-01-17
  • 打赏
  • 举报
回复
base64是可以反编译的,

MD5不可以,但你可以猜 6-7 位 我的破电脑一两天可以猜出来, 其它的吗,只要你有时间,都是可以猜出来的
getter 2009-01-13
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 froole 的回复:]
base64是可以反编译的,
MD5不可以。
Java没有这种接口。
[/Quote]
補充:java標準庫里也沒有base64,base64在sun.misc包里,用到的話最好自己包一個
海诗美妆 2009-01-13
  • 打赏
  • 举报
回复
base64是可以反编译的,
MD5不可以。
Java没有这种接口。
枫叶rain 2009-01-13
  • 打赏
  • 举报
回复
MD5不可解密
同意
MT502 2009-01-12
  • 打赏
  • 举报
回复
public static void main(String[] args) {
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);
}
}
}

如果参数没错的话,那运行一下就能找到正确的参数组合。
our651 2009-01-12
  • 打赏
  • 举报
回复
MD5貌似不克逆的啊
  • 打赏
  • 举报
回复
MD5 是散列加密的,在加密的过程中会丢失一些信息,因此是不可逆、无法解密的。

山东大学的王小云教授所发表的论文并不是将 MD5 进行解密,而是找到 MD5 碰撞的方法。
简单地说,碰撞就是不同的字符串生成了相同的摘要信息。
nx350528980 2009-01-12
  • 打赏
  • 举报
回复
谁能帮我用这些参数
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源码!
KingZChina 2009-01-12
  • 打赏
  • 举报
回复
能把MD5解密? 我的看看 不是说有个中国的女教授能解密吗?
getter 2009-01-12
  • 打赏
  • 举报
回复
把二元數據轉換成十六進制字符串會顯得過長了,一個byte,要用兩個word來表示,BASE64編碼後的字符串花費只是原來的1.5倍
getter 2009-01-12
  • 打赏
  • 举报
回复
.....
BASE64是一種字符串編碼格式...方便網上傳輸
MD5是一種信息摘要,message digest(hash),理論上存在若干個hash值相同的東西,但若要從摘要值逆運算取得原東西是計算上不可逆的,所以message digest是單方向的...
KOOK_OKKO 2009-01-12
  • 打赏
  • 举报
回复
用这个吧,我们项目用的,上面那个是网上拷贝的


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"));
}
}

nx350528980 2009-01-12
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 KOOK_OKKO 的回复:]
Java code
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 = Me…
[/Quote]
这里面的StringUtils这个类是属于那个包里的啊,你好像没有引入这个包!
Huangyifei 2009-01-12
  • 打赏
  • 举报
回复
No way
KOOK_OKKO 2009-01-12
  • 打赏
  • 举报
回复

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(""));
}

}


KOOK_OKKO 2009-01-12
  • 打赏
  • 举报
回复
MD5 是不可逆算法

之所以把用户的 密码 MD5加密之后存储,

是怕数据库万一泄露,用户的密码不至于被别人知道

这是一种对用户负责的态度。
liuhua19841201 2009-01-12
  • 打赏
  • 举报
回复
MD5解密不可以,base64也只是编码改一下 没有密钥的
可以用dsc或者asc

62,629

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧