MD5算法在java中解密 [英] MD5 algorithm Decryption in java

查看:618
本文介绍了MD5算法在java中解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以解密下面的代码?下面是我正在加密String值的方法。如果是解密可以请指导我怎么做,根据我的理解MD5算法是不能解密能力,但现在我的工作是找到解密的方式。请提供您的宝贵意见,以完成它。

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

祝你好运。 MD5是一个散列,这意味着从输入到输出的单向,不一定是双射变换。已知MD5弱,但仅用于一般冲突,而不是针对所选哈希攻击。您可以尝试每一个可能的输入,直到您获得正确的哈希(或碰撞),但它在计算上是昂贵的,而不是一个好主意。另外,作为时间存储器的权衡,可以使用预先生成的彩虹表。他们需要很长时间才能生成,但是可以快速查找。由于使用它们的争议,我不会提供链接,但是您可以自由获取和获取一个,只要您在您所在司法管辖区的适用法律中。这个过程还不是一个常规的过程,而不是webapp或一般应用程序的最佳选择。

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.

你是否看过AES,并加密,允许使用该密钥进行解密?

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

这篇关于MD5算法在java中解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆