MD5 returns 128 bit values which can be represented as a sequence of 32 hexadecimal characters, which is also the type of value PHP’s md5
function returns. So CHAR(32)
would fit perfectly.
You could also turn the value into binary, i. e., 8 bit per byte instead of 4 bit per byte. This can be done with PHP’s md5
function by setting the second parameter raw_output to true
. Or in MySQL using the UNHEX
function. In that case BINARY(16)
would suffice.