Search code examples
phpmysqlsqlphpmyadminpassword-hash

Why is my binary(64) 60 char password hash shown as 60 characters in phpmyadmin, but upon exporting has four '\0's on the end?


I know \0 is ending strings. Why are there four? And why, in my php code, do I have to specifically take the substring of first 60 characters in order for password_verify to work? (e.g. $passhash = substr($result, 0, 60);)

Thanks for any and all help.


Solution

  • PHPMyAdmin is simply not displaying this to you.

    You have a 64-byte field. It's always going to be 64 bytes. If you have 60 bytes used, the last four are going to be null bytes.