THINK FIRST·CODE LATER

← All labs

Password search spaces and hashing speed

Problem

Input: the number of hash functions h, then h lines name guessesPerSecond; then password policies label alphabetSize length until the end of input.

For each policy compute the search space alphabet^length, the entropy length × log₂(alphabet) bits, and for each hash the average cracking time = space / 2 / rate. Print:

mixed8: 62^8 = 2.18e+14 guesses, 47.6 bits; average time: MD5 3.0 hours, bcrypt12 345.9 years

Time format: < 1 second below 1 s; otherwise the largest unit among seconds, minutes, hours, days, years (365.25 days) with 1 decimal; for ≥ 10⁶ years use the form 7.5e+11 years.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.