liveBook · Manning

Tempering

As explained in Hacking Cryptography

Tempering is an output transformation that applies bitwise operations to a generator state word before returning it.

Tempering transforms an MT19937 state word with bitwise shifts, XOR, and masks before returning it. The transformation rearranges bits but remains reversible when its operations are understood. section 3.1.2

Reversing a tempering step

One step has the form y2 := y1 ^ (y1 << S) & B. Recovery proceeds in the opposite direction, repeatedly reconstructing dependent bits until the original word is recovered. Applying untemper to enough generated outputs recovers MT19937 state and enables an identical clone. section 3.1.2

How Hacking Cryptography covers it

How deep it goes
Explains XOR-shift-and-mask operations down to individual bits and provides their executable inverse, stopping at MT19937.
Examples
Uses MT19937’s XOR-shift-and-mask equation, bit diagrams, untemper code, and a test matching cloned and original outputs.
What it assumes
Assumes familiarity with MT19937 state words and introduces the required XOR, shift, mask, and bit-recovery operations.
What you can do after
Diagnose state exposure by reversing tempering and implementing an MT19937 clone from observed outputs.
How it connects
Connects tempering with bitwise operations, XOR shifts, pseudorandom number generators, and MT19937 state cloning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.