wmde/WikibaseQueryEngine — pull request #22 by thiemowmde (2014-04-21 22:12:25+00:00)
Title: Hash collisions for strings with MAX_LENGTH characters

In the new test I added the two input strings
* `"012345678901234567890123456789012345678901234567890"` and
* `"012345678901234567890123456789dae077f0a9dbf13cea96"`

both resulted in the same hash (because the first was hashed and became the second, but the second was returned as it was). I'm using the most simple metric to detect strings that possibly collide with hashes: their length. An other valid solution would be something like `if ( strlen( ... ) > 50 || ( strlen( ... ) === 50 && preg_match( '/[\da-f]{20}$/', ... ) ) )` but that's obviously overkill.