How many characters should I reserve in my database for storing SHA512 hash?
Frage
Column: pwdhash
Type: char
Many web pages give me the bit size, not a character size. Should I use a binary field instead?
Lösung
64 bytes when stored in BLOB.
128 characters when stored as hex.
~88 characters when stored as Base64.
Andere Tipps
Yes, you should use a binary field.
A hash is not a string.
For readability reasons, these are sometimes stored as hexadecimal digits (two digits per byte). So 512 bits requires 64 bytes, which would need a char(128)
field. If you used a binary field, it would only need 64 bytes.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow