26.07.2018 Views

hacking-the-art-of-exploitation

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

and diffusion. Confusion refers to methods used to hide relationships between<br />

<strong>the</strong> plaintext, <strong>the</strong> ciphertext, and <strong>the</strong> key. This means that <strong>the</strong> output bits<br />

must involve some complex transformation <strong>of</strong> <strong>the</strong> key and plaintext. Diffusion<br />

serves to spread <strong>the</strong> influence <strong>of</strong> <strong>the</strong> plaintext bits and <strong>the</strong> key bits over as<br />

much <strong>of</strong> <strong>the</strong> ciphertext as possible. Product ciphers combine both <strong>of</strong> <strong>the</strong>se<br />

concepts by using various simple operations repeatedly. Both DES and AES<br />

are product ciphers.<br />

DES also uses a Feistel network. It is used in many block ciphers to<br />

ensure that <strong>the</strong> algorithm is invertible. Basically, each block is divided into<br />

two halves, left (L) and right (R). Then, in one round <strong>of</strong> operation, <strong>the</strong> new<br />

left half (L i ) is set to be equal to <strong>the</strong> old right half (R i−1 ), and <strong>the</strong> new right<br />

half (R i ) is made up <strong>of</strong> <strong>the</strong> old left half (L i−1 ) XORed with <strong>the</strong> output <strong>of</strong> a<br />

function using <strong>the</strong> old right half (R i−1 ) and <strong>the</strong> subkey for that round (K i ).<br />

Usually, each round <strong>of</strong> operation has a separate subkey, which is calculated<br />

earlier.<br />

The values for L i and R i are as follows (<strong>the</strong> ⊕ symbol denotes <strong>the</strong> XOR<br />

operation):<br />

L i<br />

= R i−1<br />

R i = L i−1 ⊕ f(R i−1 , K i )<br />

DES uses 16 rounds <strong>of</strong> operation. This number was specifically chosen to<br />

defend against differential cryptanalysis. DES’s only real known weakness is<br />

its key size. Since <strong>the</strong> key is only 56 bits, <strong>the</strong> entire keyspace can be checked<br />

in an exhaustive brute-force attack in a few weeks on specialized hardware.<br />

Triple-DES fixes this problem by using two DES keys concatenated<br />

toge<strong>the</strong>r for a total key size <strong>of</strong> 112 bits. Encryption is done by encrypting <strong>the</strong><br />

plaintext block with <strong>the</strong> first key, <strong>the</strong>n decrypting with <strong>the</strong> second key, and<br />

<strong>the</strong>n encrypting again with <strong>the</strong> first key. Decryption is done analogously, but<br />

with <strong>the</strong> encryption and decryption operations switched. The added key size<br />

makes a brute-force effort exponentially more difficult.<br />

Most industry-standard block ciphers are resistant to all known forms <strong>of</strong><br />

cryptanalysis, and <strong>the</strong> key sizes are usually too big to attempt an exhaustive<br />

brute-force attack. However, quantum computation provides some interesting<br />

possibilities, which are generally overhyped.<br />

0x731<br />

Lov Grover’s Quantum Search Algorithm<br />

Quantum computation gives <strong>the</strong> promise <strong>of</strong> massive parallelism. A quantum<br />

computer can store many different states in a superposition (which can be<br />

thought <strong>of</strong> as an array) and perform calculations on all <strong>of</strong> <strong>the</strong>m at once.<br />

This is ideal for brute forcing anything, including block ciphers. The superposition<br />

can be loaded up with every possible key, and <strong>the</strong>n <strong>the</strong> encryption<br />

operation can be performed on all <strong>the</strong> keys at <strong>the</strong> same time. The tricky p<strong>art</strong><br />

is getting <strong>the</strong> right value out <strong>of</strong> <strong>the</strong> superposition. Quantum computers are<br />

weird in that when <strong>the</strong> superposition is looked at, <strong>the</strong> whole thing decoheres<br />

into a single state. Unfortunately, this decoherence is initially random, and<br />

<strong>the</strong> odds <strong>of</strong> decohering into each state in <strong>the</strong> superposition are equal.<br />

Cryptology 399

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!