  We compute the cohomology with trivial coefficients of Lie algebras
$\mathfrak{m}_0$ and $\mathfrak{m}_2$ of maximal class over the field
$\mathbb{Z}_2$. In the infinite-dimensional case, we show that the cohomology
rings $H^*(\mathfrak{m}_0)$ and $H^*(\mathfrak{m}_2)$ are isomorphic, in
contrast with the case of the ground field of characteristic zero, and we
obtain a complete description of them. In the finite-dimensional case, we find
the first three Betti numbers of $\mathfrak{m}_0(n)$ and $\mathfrak{m}_2(n)$
over $\mathbb{Z}_2$.
