16.01.2015 Views

Hacking

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Without some way to manipulate the odds of the superposition states,<br />

the same effect could be achieved by just guessing keys. Fortuitously, a man<br />

named Lov Grover came up with an algorithm that can manipulate the odds<br />

of the superposition states. This algorithm allows the odds of a certain desired<br />

state to increase while the others decrease. This process is repeated several<br />

times until the decohering of the superposition into the desired state is<br />

nearly guaranteed. This takes about O n steps.<br />

Using some basic exponential math skills, you will notice that this just<br />

effectively halves the key size for an exhaustive brute-force attack. So, for the<br />

ultra paranoid, doubling the key size of a block cipher will make it resistant<br />

to even the theoretical possibilities of an exhaustive brute-force attack with a<br />

quantum computer.<br />

0x740<br />

Asymmetric Encryption<br />

Asymmetric ciphers use two keys: a public key and a private key. The public<br />

key is made public, while the private key is kept private; hence the clever names.<br />

Any message that is encrypted with the public key can only be decrypted with<br />

the private key. This removes the issue of key distribution—public keys are<br />

public, and by using the public key, a message can be encrypted for the<br />

corresponding private key. Unlike symmetric ciphers, there’s no need for an<br />

out-of-band communication channel to transmit the secret key. However,<br />

asymmetric ciphers tend to be quite a bit slower than symmetric ciphers.<br />

0x741<br />

RSA<br />

RSA is one of the more popular asymmetric algorithms. The security of RSA<br />

is based on the difficulty of factoring large numbers. First, two prime numbers<br />

are chosen, P and Q, and their product, N, is computed:<br />

N = P · Q<br />

Then, the number of numbers between 1 and N − 1 that are relatively<br />

prime to N must be calculated (two numbers are relatively prime if their greatest<br />

common divisor is 1). This is known as Euler’s totient function, and it is usually<br />

denoted by the lowercase Greek letter phi (φ).<br />

For example, φ(9) = 6, since 1, 2, 4, 5, 7, and 8 are relatively prime to 9.<br />

It should be easy to notice that if N is prime, φ(N ) will be N − 1. A somewhat<br />

less obvious fact is that if N is the product of exactly two prime numbers, P<br />

and Q, then φ(P · Q) = (P − 1) · (Q − 1). This comes in handy, since φ(N )<br />

must be calculated for RSA.<br />

An encryption key, E, that is relatively prime to φ(N), must be chosen<br />

at random. Then a decryption key must be found that satisfies the following<br />

equation, where S is any integer:<br />

E · D = S · φ(N) + 1<br />

This can be solved with the extended Euclidean algorithm. The Euclidean<br />

algorithm is a very old algorithm that happens to be a very fast way to calculate<br />

400 0x700

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

Saved successfully!

Ooh no, something went wrong!