
In 2008 a Debian maintainer, silencing a memory warning, commented out the line that fed randomness into OpenSSL. For two years every key generated on Debian and Ubuntu leaned on almost nothing but the process id, so only 32768 different keys were ever possible. Attackers could just precompute all of them. Two processes whose ids match modulo 32768 got the exact same key. Count how many truly distinct keys a batch of processes would make.
Objective
Count the distinct keys produced, where each process's key is its process id modulo 32768.
Steps
$ distinct_keys({100,200,300}, 3)
3
$ distinct_keys({1,32769,5}, 3)
2
$ distinct_keys({7,7,7}, 3)
1
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...