[TYPO3-english] Duplicate cHash values

Dmitry Martynenko dima at realt.by
Mon Jan 19 12:22:23 CET 2009


Hi Dmitry,

>>> May be better solution is to decrease key length - for example use 16
>>> byte (binary) MD5 value, instead of 32 chars value. In any case they are equal.
>>> Binary comparison is always faster then text comparison. Because text
>>> comparison also takes in account character sets and case sensitivity.

DD>> md5 provides uniqueness only if it is full 32-bit value. Using 16
DD>> bit will decrease probablity of conflict but will not eliminate it.

DM> I mean another thing!

DM> MD5 has 128 bit value (not 16 bit or 32 bit)

DM> In binary it is 16 byte value (16 * 8 = 128 bit)
DM> In HEX it has presentation of 32 chars value (2 chars for each byte)

DM> I suggest to store it as 16 byte value in BINARY(16) MySQL field,
DM> instead of using 32 char value in CHAR(32) MySQL field.
DM> In PHP it is represented as HEX value in both case.

DM> I think it is faster for search and leads to smaller DB size.

One example.

Now I have tx_realurl_chashcache table like (it differs from standart
RealURL table - spurl_hash already store full MD5 value):

CREATE TABLE `tx_realurl_chashcache` (
  `spurl_hash` VARCHAR(32) NOT NULL DEFAULT '',
  `chash_string` VARCHAR(10) NOT NULL DEFAULT '',
)

If extend chash_string to full MD5 it will be VARCHAR(32),
and each record will occupy 64 bytes.

But if use BINARY(16) for both fields, then each record will occupy only 32 bytes.

-- 
Dmitry Martynenko
Developer

Web: http://realt.by



More information about the TYPO3-english mailing list