Tabulate the AVERAGE brute-force time, in years, for 40-, 56-, 128- and 168-bit keys at 10^9 and 10^13 trials per second. Recompute every exponent — do not copy one.
Tabulate the AVERAGE brute-force time, in years, for 40-, 56-, 128- and 168-bit keys at 10^9 and 10^13 trials per second. Recompute every exponent — do not copy one.
Answer
def average_years(key_bits, rate): trials = 2 ** (key_bits - 1) return trials / rate / (365.25 * 24 * 3600) print('bits 1e9 keys/s 1e13 keys/s') for bits in (40, 56, 128, 168): slow = average_years(bits, 10 ** 9) fast = average_years(bits, 10 ** 13) print(f'{bits:>4} {slow:>12.3e} {fast:>12.3e}')
SB5e ch2 §2.1; ch20 §20.1