java md5解密算法,MD5算法在java中解密

Is it possible to decrypt the below code? below is my method where we are encrypting the String values. If it is decrypt able please guide me how to do that, as per my understanding MD5 algorithm is not decrypt able but for now my job is to find the way to decrypt it. Please provide your valuable opinion to get it done.

public static String encryptPassword(final String password) {

if (MyUtil.isEmpty(password)) {

return null;

}

MessageDigest digest;

try {

digest = MessageDigest.getInstance("MD5");

digest.update(password.getBytes(), 0, password.length());

String secured = new BigInteger(1, digest.digest()).toString(16);

return secured;

} catch (NoSuchAlgorithmException e) {

e.printStackTrace();

}

return null;

}

解决方案

but for now my job is to find the way to decrypt it

Good luck. MD5 is a hash, which means a one-way, not necessarily bijective transformation, from input to output. MD5 is known to be weak but only for general collisions, and not for a chosen-hash attack. You can try every single possible input until you get the right hash(or a collision) but it is computationally expensive, and not a necessarily good idea. In addition, as a time-memory tradeoff, pre-generated rainbow tables may be used. They take long to generate, but have fast lookups. I will not provide a link them due to the controversy of using them, but you may obtain and acquire one freely, as long as you are within applicable laws in your jurisdiction. This process is still not a routine one, and isn't the best idea for a webapp or general application.

Have you looked into AES instead, which has a key, and encrypts, allowing decryption with that key?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值