This is the cops thread of this cops and robbers challenge. The robbers thread is here.
Related, but hashes numbers instead of strings and uses a different scoring system.
Definitions
A hash collision is when two different strings produce the same hash.
Summary
In this challenge, the cops will make a hash function, with a collision they know of. Then, the robbers will try to crack it by finding a hash collision in the cop's hash algorithm. To crack an answer, the hash collision the robber finds does not have to be the intended solution.
If a cop submission is not cracked for 7 days, it is safe, so mark it as such and reveal the intended crack and the score.
If a cop submission is cracked, mark it as such and edit in a link to the crack.
Rules
- Cryptographic functions are allowed only if you know a collision in them. If it is a famous and secure hash algorithm like SHA-256, you must post the hashes of each string in a different, specified hash algorithm (ideally also in a secure hash algorithm), like Keccak-512.
Format
A cop answer has to contain the language and the source code.
Scoring
The score of a safe cop answer is the sum of the number of bytes of the two strings with the hash collision, with the lower score being better.
The winner
With robbers and cops being ranked separately, the winner is the person with the best scoring answer.
Example
Cop:
Python
from hashlib import* def singlecharhash(x): a = blake2b(digest_size=1) a.update(x) return a.hexdigest()
Robber:
4 Points, Cracks cop's answer
¯
andÉ
, both 2 bytes.
Pinboard
I am thinking of changing the scoring system to make it the minimum of the two strings. Any thoughts?
É
is not one byte in utf-8. if you use a different encoding you need to state which one \$\endgroup\$return STRING2 if sha256(x) == STRING1 else return sha256(x)
would havesha256^-1(STRING1)
andsha256^-1(STRING2)
as a collision, but all other collisions would imply a collision in SHA256 (which obviously isn't feasible for a robber to find) \$\endgroup\$