  In this paper we construct binary self-dual codes using the \'etale
cohomology of $\mathbb{Z}/2$ on the spectra of rings of $S$-integers of global
fields. We will show that up to equivalence, all self-dual codes of length at
least 4 arise from Hilbert pairings on rings of $S$-integers of $\Q$. This is
an arithmetic counterpart of a result of Kreck and Puppe, who used cobordism
theory to show that all self-dual codes arise from Poincar\'e duality on real
three manifolds.
