Storing MD5 values

A common occurrence I have noticed in MySQL apps is that MD5 values are stored as 32 byte values rather than 16. Just to β€˜rehash’, an MD5 value is a 16 byte hexadecimal value, typically used as a unique fixed-length signature of a string, useful for identifying unique strings or one-way encryption of passwords. The binary representation takes 16 bytes (e.g. BINARY(16)), though a human readable hexadecimal version takes twice as many (e.g. CHAR(32)).

Same goes for IPv4 address, which can be stored as UNSIGNED INT (4 bytes) instead of VARCHAR(16) (16 bytes)

Tip: Storing MD5 values →

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.