We argue below that, using the One Time Pad scheme, the sequence of bits flying across the channel is a random sequence of bits.
A similar argument establishes that Pr(s[i]=0 intersect m[i]=1)=Pr(s[i]=1 intersect m[i]=1). We call this number y.
Now Pr(s[i]=0)=Pr(s[i]=0 intersect m[i]=0)+Pr(s[i]=0 intersect m[i]=1) since these are mutually exclusive events. So Pr(s[i]=0)=x+y. Similarly Pr(s[i]=1)=x+y. So Pr(s[i]=0)=Pr(s[i]=1)=1/2. That is, the s[i] is a random stream of bits and the one time pad scheme is secure.
Imagine Alice and Bob both have the same secret number r (this is the key or the random seed). Alice has a binary message m0, m1, ..., mn-1 which she wants to securely (against Eve) send to Bob. Alice does the following:
The above scheme (using a pseudo random number generator to generate a onetime pad) relies on a shared secret random seed (called r above). You might wonder how Alice and Bob can exchange such a secret in the presence of Eve. Of course, Alice could physically visit Bob to exchange the secret. It turns out that Alice and Bob can agree on a secret number using the insecure channel and that, under some cryptographic assumnptions, Eve will not know the secret. This is the Diffie Hellman Key Exchange. See the RSA Labs article. or this great video.
Alice sends m as well as Ee(m) to Bob. Bob verifies that the message m1 recieved and the encrypted version m2 satisfy Dd(m2)=m1. If these match then Bob has confidence that the message recieved was encrypted using Alices private key e. Note: It is still possible for Mallory to resend a pair previously seen. This technique protects against Mallory manipulating the message m parts of a message.
For an unkeyed hash function h, we would like to have
Exercise: Which of the above 3 properties does this hash function violate (it is not a good choice for a cryptographic hash function).
MD5 has been broken by using Rainbow tables (rainbow report). The idea: let MD5k be MD5 run on itself, k times. So MD53("this is something")= MD5(MD5(MD5("this is something"))). Create a table as follows... (intuition only, details are not necessarily correct, in fact reduce(MD5(x)) is computed in each round)...
To use this table, say I want to find a pre-image of y, do the following
In terms of MD5, Alice and Bob would have the same secret string (called salt). Alice would send m as well as MD5(salt+m) (+ is string concatenation). Bob receives m' and h' and checks whether MD5(salt+m')=h'.
When a users password is created, random salt (for this users password) is computed. MD5(salt+password) is computed and both the salt and MD5(salt+password) are stored in the /etc/shadow file. When a user attempts a logs in, their entry in /etc/shadow is fetched (if it exists). The random salt appears in that entry and this is added to the supplied password. This is compared with the entry in /etc/shadow and, if they match, the user is allowed to log in.
Below is a few lines taken from /etc/shadow. $1$ indicates that MD5 is used. For arnold the salt used is $1$BrsaVm9R$. The result of salting and MD5ing arnolds password is pAmsCoQfoijNt6H/DuRjF0. hacker's salt is $1$ufns7sR1$.
The following PHP script actually verifies arnold...given the password and the salt, it produces the above hash.
In terms of Rainbow tables, this means that to crack a particular password (knowing the salt and MD5(salt+password)) you would actually need to create a rainbow table specifically for this one password. You could not use an existing rainbow table.
Exercise: How does adding salt prevent a hacker from authenticating even though they have stolen the /etc/shadow file?
Alice gets a public, private key pair (ke, kd). Knowing one does not
easily lead to knowing the other. Alice publishes her public key ke and keeps the private key
securely hidden. ke and kd are inverses with respect to RSA, that is
RSA(kd, RSA(ke, m))= RSA(ke, RSA(kd, m))=m
Alice now has private key (p,q,d) and public key (pq,e)
Bob has message M (a natural number) and wants to send it encrypted to Alice. He does the following
RSA is not known to be more secure than block ciphers. The difference here is that RSA is not symmetric AND it is difficult to find the private key given the public key and vice versa.
RSA calculations are time consuming. Typically RSA is used to exchange a session key (ie for 3DES).