asp.net加密和解密

编程入门 行业动态 更新时间:2024-10-28 12:18:11
本文介绍了asp加密和解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在ASP.NET中解密已经使用MD5格式加密的密码?

How can i decrypt a password that had already encrypted using MD5 format in ASP.NET?

推荐答案

"...使用MD5格式加密的密码. ..":不可能,加密与加密哈希相同. MD5 [ ^ ]是一种哈希算法,它严格地以一种方式工作.哈希值一旦被哈希化,就无法从哈希值中重建出来. 问候, 曼弗雷德 "... encrypted using MD5 format ...": No way, is encryption the same as a chryptographic hash. MD5[^] is a hashing algorithm and it works strictly one way. Once something has been hashed it can not be reconstructed from the hash. Regards, Manfred

您永远不需要解密密码.您应该做的是对密码进行哈希处理(如Manfred的回答所述,MD5是哈希算法)并将其存储.要验证密码,请对它进行哈希处理,看看它是否与先前哈希的密码匹配. You should never need to decrypt a password. What you should do is make a hash of the password (as stated in Manfred''s answer, MD5 is a hashing algorithm) and store that. To verify a password, hash it and see if it matches the previously hashed password.

除了Manfred和lewax00的回答:出于任何安全目的,请勿使用MD5或SHA-1. MD5在2008年被证明是可破解的,在2005年发现了SHA-1缺陷.请参阅: msdn.microsoft. com/en-us/library/system.windows.controls.mediaelement.mediaended%28v = vs.100%29.aspx [ ^ ], en.wikipedia/wiki/SHA1 [ ^ ]. 相反,我建议使用SHA-2系列算法之一: en.wikipedia/wiki/SHA2 [ ^ ]. 您将在.NET中找到所有这些算法的实现: msdn.microsoft/en-us/library/system. security.cryptography.hashalgorithm.aspx [ ^ ].
—SA
In addition to the answers by Manfred and lewax00: never use MD5 or SHA-1 for any security purposes. MD5 was proven to be broken in 2008, and SHA-1 flaw was found in 2005. Please see: msdn.microsoft/en-us/library/system.windows.controls.mediaelement.mediaended%28v=vs.100%29.aspx[^], en.wikipedia/wiki/SHA1[^]. Instead, I would advice using one of the algorithms from the SHA-2 family: en.wikipedia/wiki/SHA2[^]. You will find implementation of all those algorithm in .NET: msdn.microsoft/en-us/library/system.security.cryptography.hashalgorithm.aspx[^].
—SA

更多推荐

asp.net加密和解密

本文发布于:2023-05-31 10:02:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389501.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!