[TYPO3-core] RFC: Make image hash names longer to avoid collisions

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sun May 20 10:51:42 CEST 2007


Andreas Otto schrieb:
> Hi Masi,
> 
> Martin Kutschker wrote:
>> I never understood the logic of using truncated md5 hashes and argued
>> before to use only the real hashes. Certainly the "beauty" of a generated
>> filename cannot be a reason, right?
> 
> Me neither, truncating md5 hashes and using the generated subtring of the
> md5 hash is asking for collisions, which will happen sooner or later.
> 
> To fix this we have to do quite some work:
> 
> * Check DB layout: Where are short md5 hashes used?
> * Check TYPO3core: Where are short md5 hashes used?
> * How to change existing code to make use of full-length md5 hashes? What
> about backwards-compatibility?

I wouldn't mess the with the current implementation of 
t3lib_div::shortMD5().

I'd change any occurences of this function in the Core where it's used 
to create filenames. Should be easy, but we need to advise our users to 
clear the typo3temp directory! *

Then I'd see where these short MD5s are used in the DB. Of course we can 
change it there as well, but we have to make sure that clearing a 
temp/cache table is enough after a switch to real MD5 hashes.

And of course we must deprecate the function :-)

Masi

* Maybe we can optimize the directory layout of typo3temp while doing 
that. Eg we know that BE thumbs and FE images clutter up the directory. 
We could (if we start the filenames with the hash) add subdir named 0-9 
and a-f to distributes the file a bit.


More information about the TYPO3-team-core mailing list