MySQL: what data type to use for hashed password field and what length

Encryption Functions

It depends on the hashing algorithm you use. Hashing always produces a result of the same length, regardless of the input. It is typical to represent the binary hash result in text, as a series of hexadecimal digits.

  • MD5 generates a 128-bit hash value, which can be represented in CHAR(32)
  • SHA-1 generates a 160-bit hash value, which can be represented in CHAR(40)
  • SHA-224 generates a 224-bit hash value, which can be represented in CHAR(56)
  • SHA-256 generates a 256-bit hash value, which can be represented in CHAR(64)
  • SHA-384 generates a 384-bit hash value, which can be represented in CHAR(96)
  • SHA-512 generates a 512-bit hash value, which can be represented in CHAR(128)