I have passwords hashed into 512 bits, how to store them in MySQL?
Initially I wanted BINARY(512)
However binary has fixed length 255.
I know I can use VARBINARY(512)
But since my data is “fixed” and not variable-length, i do not think this is the best solution and am looking for a better alternative.
From the page http://dev.mysql.com/doc/refman/5.0/en/blob.html:
In some cases, it may be desirable to
store binary data such as media files
inBLOBorTEXTcolumns. You may find
MySQL’s string handling functions
useful for working with such data.
So does that mean that there is another way to store binary data other than BLOB?
Since 512-bit is 64-byte, you can use
BINARY(64)for that purpose. Please note that length forBINARY()type is measured by bytes and not bits.From MySQL Reference Manual: