patternsqlModerate
Why are mysql password hashes internally saved with a star (asterisk)?
Viewed 0 times
whyinternallystararewithpasswordmysqlhashessavedasterisk
Problem
I was reading upon some mysql internals, when going through the mysql.user table in the my
The password is obviously hashed, but why does it begin with the star (asterisk)?
mysql shell, I getmysql> select * from mysql.user limit 1 \G
*************************** 1. row ***************************
Host: localhost
User: root
Password: *81F5E21E35407D884A6CD4A731AEBFB6AF209E1BThe password is obviously hashed, but why does it begin with the star (asterisk)?
Solution
Ok, found about this in the documentation itself.
This was a change introduced in mysql 4.1 so that the earlier password lengths of 16 characters and newer password lengths of 40 characters could be simultaneously supported. The Password column was made 41 bytes (chars) long, and the newer passwords would begin with a mandatory
From the documentation:
Password hashes in the 4.1 format always begin with a “*” character, whereas passwords in the pre-4.1 format never do.
This was a change introduced in mysql 4.1 so that the earlier password lengths of 16 characters and newer password lengths of 40 characters could be simultaneously supported. The Password column was made 41 bytes (chars) long, and the newer passwords would begin with a mandatory
* to identify them.From the documentation:
Password hashes in the 4.1 format always begin with a “*” character, whereas passwords in the pre-4.1 format never do.
Context
StackExchange Database Administrators Q#98529, answer score: 15
Revisions (0)
No revisions yet.