An analogy for this, from the same book, is about paint.

Alice and Bob both start with a non-secret color of paint. Each one adds his or her secret color to the can, and sends the can to the other person. The only way Eve can determine what color has been added is to try a whole bunch of combinations. This is very hard. Once Alice and Bob have each other's cans, they add their own color. Since it doesn't matter in what order the paint is added, they both have the same color, which is used as the key. Eve can't see the final result, and adding the two colors as they are passed means she will have too much of the base color. so the result is secure.

A clever means by which two parties may agree on a shared secret key purely using an insecure transport mechanism.

Example taken from Simon Singh's The Code Book

The scheme relies on the one way function Y^x mod P. Y and P may be agreed by insecure means. In this example, Y=7 and P=11. In real life, I imagine much bigger numbers would be chosen.

        Alice                    Bob
Stage 1 Alice chooses a number,  Bob chooses a number,
        say 3, and keeps it      say 6, and keeps it
        secret.                  secret.
        We label her number A    We label his number B

Stage 2 Alice puts 3 into the    Bob puts 6 into the
        one way function and     one way function and
        works out the result     works out the result of
        of 7^A mod 11:           7^B mod 11:
          7^3 mod 11               7^6 mod 11
        = 343 mod 11             = 117,649 mod 11
        = 2                      = 4
   
Stage 3 Alice calls the result   Bob calls the result
        of her calculation       of his calculation beta,
        alpha, and she sends     and he sends his result
        her result, 2, to Bob.   4, to Alice.

The     Ordinarily, this would be a crucial moment:
swap    Alice and Bob are exchanging information over a
        public transmission medium, and this is an
        opportunity for an eavesdropper to snatch some
        information.

        However, it turns out that the two numbers alpha 
        and beta are useless to an eavesdropper without
        knowledge of either A or B.

Stage 4 Alice takes Bob's        Bob takes Alice's result 
        result and works out     and works out the result of
        the result of            alpha^B mod 11:
        beta^A mod 11:
          4^3 mod 11               2^6 mod 11
        = 64 mod 11              = 64 mod 11
        = 9                      = 9
     
The     Miraculously, Alice and Bob have ended up with the
key     same number, 9. This is the key!

Log in or register to write something here or to contact authors.