문제

I see that MySQL 5.5 allows use of SHA-2() for setting passwords, and that straight MD5 hashes are insecure and should no longer be used (ditto for default PASSWORD function).

Before I go UPDATE happy and change a bunch of passwords, how does MySQL know which algorithm to use to check my supplied password? Does it magically know what algorithm was used to encrypt the user's password, or do we specify this in the conf file?

UPDATE: I tested with a new account to see what happens. Using PASSWORD('mypass') works however applying SHA1('mypass') results in that account not being able to log in.

도움이 되었습니까?

해결책

Probably by the length of the hash stored in the table. An MD5 hash would be 128 bits, a SHA1 hash would be 160 bits, and a SHA2 hash would be at least 224 bits.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top