Domanda

Possible Duplicate:
Best practices for efficiently storing md5 hashes in mysql

We use Hex representation of MD5 values in our system.

Will it be wise to store them in our MySQL DB as integers instead of strings? will that improve searching the table using the MD5 column?

Thank You

È stato utile?

Soluzione

An MD5 hash is 128 bits in size. A MySQL INT is 32 bits, a BIGINT 64 bits. So no, you can not store an MD5 hash as an INT. I would advise to use BINARY(16). And you should think again if MD5 is the right hash for your purpose or if you would be better of with something like SHA-1 (if you use MD5 for cryptography related tasks).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top