从加密功能解密方法 [英] Decrypt method from encryption function

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

问题描述

我有用于加密的口令,并将其存储到数据库如下的方法:

I have a method that is used to encrypt the password and store it to database as below :

public static string Md5Encrypted(string password)
        {
            byte[] pass = Encoding.UTF8.GetBytes(password);
            MD5 md5 = new MD5CryptoServiceProvider();
            string strPassword = Encoding.UTF8.GetString(md5.ComputeHash(pass));
            return strPassword;
        } 

现在我想要方法解密,我从中通过上述方法,同时将其存储加密的数据库获取密码。我不知道如何做到这一点。任何人都可以帮助我吗?

Now I want the method that decrypt the password that I get from database which was encrypted by above method while storing it. I don't know how to make it. Anybody can help me please?

推荐答案

MD5是散列函数(非加密)和是不可逆转的。也就是说,你不能从一个给定的哈希计算的原始值。

MD5 is a hash function (not an encryption) and is irreversible. That is, you can't compute the original value from a given hash.

更新:我推荐这篇文章描述了如何存储密码哈希安全。有一个C#实现也是如此。

Update: I recommend this article that describes how to store password hashes securely. There's a C# implementation as well.

http://crackstation.net/hashing-security.htm

这篇关于从加密功能解密方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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