Challenges
Truncated hash collision
Cryptography
Hard
Truncated collision
Solves: 9
Truncated hash collision
Author: CyberSamSU
Points
85
A full SHA-256 collision cannot be found, but if we truncate the hash (take only the first few bits), a birthday attack works very quickly. For 40 bits, an average of only ~2^20 ≈ 1 million hashes is enough.
Inputs are generated in the following format:
xabar(n) = b'CYBERSAMSU_BDAY_' + str(n).encode() # n = 0, 1, 2, ...
Task: find two n for which the first 40 bits (10 hex characters) of sha256(xabar(n)) are the same. Go sequentially starting from n = 0 and take the first collision encountered.
Flag: BAYROQ{H4SH_bday_<avval_uchragan_n>_<takror_topilgan_n>} (smaller n first, larger n second).
Write each calculated prefix to a dictionary (prefix -> n); when a prefix is encountered for the second time, a collision is found.
To submit a flag, log in.