jueves, 13 de septiembre de 2012


Sokets

Communication between different entities on a network is based on the classic concept Python sockets. Sockets are an abstract concept that refers to the end point of a connection.
The programs use sockets to communicate with other programs, which may be located on different computers.
A socket is defined by the IP address of the machine, the port on which it listens, and the protocol used.
The types and functions needed to work with Python sockets are in the socket module, how could it be otherwise.
Sockets are classified stream sockets (socket.SOCK_STREAM) or datagram sockets (socket.SOCK_DGRAM) depending on whether the service uses TCP, which is connection-oriented, reliable, or UDP, respectively. In this lesson we will cover only stream sockets, which cover 90% of the common needs.

RSA Key Generation

Divide the algorithm into 3 sections: this, key generation, encryption / decryption and signing / verification.
This part aims to generate public and private keys, composed by n one of the two exponents of example (so that the two are canceled), then go to:
First generate two primes with the number of bits we want for encryption, random everything possible, call them p and q, these numbers help us calculate the n and φ:
p = genprime (numero_de_bits)
q = genprime (numero_de_bits)
We get your product, n, and phi (φ) of this using the formula we saw earlier, φ = (p - 1) * (q - 1):
n = p * q
phi = (p - 1) * (q - 1).
































Conclusions

The program is incomplete due to connection problems because it encrypts and decrypts.



http://blog.hackxcrack.es/2011/11/introduccion-la-criptografia-moderna_09.html
http://mundogeek.net/archivos/2008/04/12/sockets-en-python/
http://www.taringa.net/posts/linux/8419721/Sockets-en-python_.html
http://es.wikipedia.org/wiki/RSA

miércoles, 5 de septiembre de 2012


Diffie-Hellman

It should test Manual Hack veryshort a key Diffie-Hellman.

To do this you must play a game where you need to have 3 players which would be: Alice, Bob and Eve. Where rotate each of the players for each of the characters once everyone

Alice chooses a prime "p", a number "g" in the interval (0, p-1) and another number "x" in the interval (0, p-1). So Alice, calculate "X = g ^ x mod p" and send all values ​​except xa Bob. Bob receives the values ​​and choose a number in the interval (0, p-1), and computes "Y = g ^ y mod p", and send the value to Alice, which computes "K = Y ^ x mod p" and Bob computes "K = X ^ y mod p". Alice and Bob should send to Eve values​​: "p, g, X, Y". Eve needs to find the value of "x" or "y" with "X = g ^ x mod p" or "Y = g ^ y mod p", Eve now computes "K = Y ^ x mod p" or "K = X ^ y mod p" and compare this value with that of Alice and Bob "K". If the value of "K" are the same, Eve hacks the Diffie-Hellman protocol

In this case the players Alex as Alice and Marco as Bob framework.

Where they published the following values

p = 17
g = 13
X = 4
Y = 1

Where I had to find the values ​​of: y, x and  k.



Finding missing numbers published the results I got awaiting a response from my partner where I point out if it was right or wrong, and in my case was correct then I can say that hacks the Diffie-Hellman protocol.