Module aoc::year2020::day25

source ·
Expand description

§Combo Breaker

The card loop size is found using the Baby-step giant-step algorithm. This takes only √20201227 = 4495 steps, compared to potentially up to 20201227 steps for the brute force approach.

The common encryption key is then calculated efficiently by modular exponentiation using exponentiation by squaring.

Functions§