views:

212

answers:

4

Possible field types:

BINARY(16)
CHAR(32)
BIGINT + BIGINT

How do I decide which one to use?

+1  A: 

An MD5 hash is typically expressed as a 32 digit hex number. CHAR(32) will work just fine.

thetaiko
+1  A: 

None.

Don't use MD5, it's a dead hash. Use SHA-2 or above, and store is as a series of hex characters (64 characters). It's very nice to read, in this fashion, and it's the standard approach.

Noon Silk
+1  A: 

im no good at MySql but a hash is nomaly a byte array so BINARY(16) should be the best, but it might be harder to write custom sql questions against Binary if thats needed?

Petoj
+3  A: 

If the column is indexed and you know what you're doing, BINARY(16) for performance reasons.

Otherwise, CHAR(32) is fine. Make sure the column uses the ascii charset though. (ascii_bin for example)

Josh Davis