The mathematics involved include modular arithmetic, a bit of number theory, some linear algebra of two dimensions with matrices, some combinatorics, and a little statistics.
The calculations involve modular arithmetic, a small amount of number theory, some two-dimensional linear algebra with matrices, some combinatorics, and a little statistics.