 One way to do this is by a protocol originally proposed by Artur Ekert. Suppose Alice has a collection of photons, one for each entangled pair in the state \(\ket{0}\ket{0} + \ket{1}\ket{1}\) (ignoring the equal coefficients, for simplicity), and Bob has the collection of paired photons. Alice measures the polarization of her photons randomly in directions, \(0, \pi/8, 2\pi/8\) with respect to some direction \(z\) they agree on in advance, and Bob measures the polarizations of his photons randomly in directions \(\pi/8, 2\pi/8, 3\pi/8\). They communicate the directions of their polarization measurements publicly, but not the outcomes, and they divide the measurements into two sets: one set when they both measured polarization in the direction \(\pi/8\), or when they both measured polarization in the direction \(2\pi/8\), and one set when Alice measured polarization in directions \(0\) or \(2\pi/8\) and Bob measured polarization in directions \(\pi/8\) or \(3\pi/8\). For the first set, when they measured the polarization in the same direction, the outcomes are random but perfectly correlated in the entangled state so they share these random bits as a cryptographic key. They use the second set to check a Bell inequality, which reveals whether or not the entangled state has been altered by the measurements of an eavesdropper. (See Ekert, 1991.)