且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么不在AES中使用AES进行密码加密?

更新时间:2023-11-13 23:47:28

如果您存储密码加密,可以解密。由于许多人在许多不同的系统中重用密码,这是一件坏事。所以你使用一个单向函数加密散列函数 - 这样一个密码可以被验证,而不会被实际被揭示。



正如Greg所说,AES是一种加密/解密算法。 MD5和SHA系列是哈希函数,它们是更合适的使用。但是,现在远离 MD5,它不再被视为足够安全。王小云2005年出版了一次有效的碰撞攻击,其实力已经远远低于其设计实力 - 因此加密术语破碎。



为了获得***效果,标准是将密码进行盐和哈希存储 - 谷歌这些术语,您会发现许多参考。


Everywhere I have seen people talking about storing passwords in a database, they have almost always used MD5.

What is wrong with AES, or SHA1?

If you store a password encrypted, it can be decrypted. Since many people reuse passwords across many different systems, this is a bad thing. So you use a one-way function, a cryptographic hash function - this way a password can be verified without actually being revealed.

As Greg commented, AES is an encryption/decryption algorithm. MD5 and the SHA family are hash functions, which are the more appropriate ones to use. But steer clear of MD5 nowadays - it's not really seen as secure enough any more. Xiaoyun Wang published an effective collision attack against it in 2005, and its strength is now seen as considerably below its design strength - thus in cryptographic terms it is "broken".

For best results, the standard is to salt and hash a password to store it - google these terms in tandem and you'll find numerous references.