miércoles, 5 de septiembre de 2012

Entrada # 4

For this week consisted of make an example with the Diffie-Hellman protocol.

The Diffie-Hellman protocol can be explained by the following problem:

We have two people (Alice and Bob) who are in the same communication with Eve, to the problem Alice and Bob want to communicate among themselves.

To do this it have the following procedure

Define values​​: 'p' and 'g' (this makes him Alice or Bob), as these values have to pass the Alice to Bob (or vice versa), as Eve learns them.

The following Alice and Bob define the values ​​of 'x' and 'y' respectively, these are not the pass to the other Eve therefore not know the value of these.

Making note:
Alice have the values of 'x', 'p' y de 'g'
Bob have the values of 'y', 'p' y de 'g'
Eve have  'p' y 'g'

As these values are not sufficient to make the communication must provide other data but must be one with which Eve can not easily discover the values ​​of 'x' and 'y'let alone give those values.

So Alice uses the following equation to obtain 'X' and Bob to obtain 'Y':

Alice(X) ó Bob (Y) = (g^(x ó y)) mod p

Once they both have those values​​, be the pass to each other is: 'Alice passes Bob X' and 'Bob passes Y to Alice', these values ​​Eve finds out them and takes them.

Making note again:
Alice have the values of 'x', 'p', 'g', 'X', 'Y'
Bob have the values of 'y', 'p', 'g', 'X', 'Y'
Eve have  'p', 'g', 'X', 'Y'

Please note that not all values there are none in which only Alice and Bob know therefore be drawn more to a value that can be used as a shared key for them and communicate through that.

This value will call K, this can be found by the following equations:

K = (X^y) mod p
K = (Y^x) mod p
K = ((g^x)^y) mod p -> If know the values of 'x' and 'y'
K = ((g^y)^x) mod p -> If know the values of 'x' and 'y'

Eve can not find K because do not have 'x' and 'y'.

Making note for the last time, we determined that:

Alice have the values of 'x', 'p', 'g', 'X', 'Y', 'K'

Bob have the values of 'y', 'p', 'g', 'X', 'Y', 'K'

Eve have  'p', 'g', 'X', 'Y'

The way for Eve can find the values ​​of 'x' and 'y', would be testing random numbers using the formula of X and Y; find these comparing them having Eve, obtain the values ​​originally wished.

Now with that could determine K.

As an aside, you have to make clear a few things when making use of this protocol:

          p -> Must be a  número entero primo

          g-> Must a number integer to less than p
          x-> Number chosen by Alice, be less than p
          y-> Number chosen by Bob, be less than p
          mod-> It means % in some programming languages​​, to explain how to obtain would be through:

                       Asks 6% 5 or 6 mod 5. - This is equal to 6/5, if what comes out is an integer without decimals the result is 0 if not, grab the decimal part of the problem (6/5 = 1.2) and you multiply it by the value of the mod (in this case 5), 0.2 X 5 = 1 and what you round it out, what comes out will be the result (6% 5 = 1).


What is commissioned task was to choose two companions who would Alice and Bob, I chose to Alejandro Avendaño and Eduardo
Triana respectively and Eve I would be therefore have to find the values ​​of 'x', 'y' and 'K '.

Then I show the values ​​of 'p', 'g', 'X' and 'Y' supplied by them.

Basen in the image, we have:

p = 13
g = 7
X = 9
Y = 12

The next thing is to try to find x or y, I chose to try to find 'x' then 'y'.

As seen in the image I tried x values ​​that were under p, to find X and this compared with they gave me them, but was tried with another and so on until you find the correct X value.

Then I did the same with to find Y.

Already with the data found kick K, so that the value is correct I did with the two equations that there.

Once you do that wrote the values ​​found in the publication:

To complement the above create a file in python to check if my results were correct.

And the result:


1 comentario:

  1. "Alice has", "Bob has" (son singulares); tu explicación del módulo salió pésimo - estás diciendo que 6 mod 5 es igual a 6/5 :/
    Lo de la tarea en sí está bien; 7 pts.