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 mathematics used in this context includes modular arithmetic, number theory, two-dimensional linear algebra with matrices, combinatorics, and statistics.