Materias

  • Auto (12)
  • Criptografía (7)
Mostrando entradas con la etiqueta Criptografía. Mostrar todas las entradas
Mostrando entradas con la etiqueta Criptografía. Mostrar todas las entradas

jueves, 25 de octubre de 2012

Entrada # 8

Stream Ciphers

The stream ciphers are algorithms that can to perform encryption incrementally converting plaintext into ciphertext bitwise.

To accomplish this we construct a keystream generator (bit sequence undefined size which can be used to encrypt the data stream by combining the keystream to the data stream using the XOR function).

If the key stream is secure, encrypted data flow will be too.

For this week commissioned us choose a stream cipher and explain, for this occasion I chose:ISAAC.


Stream Cipher ISAAC

History


The letters are an acronym of ISAAC Indirection, Shift, Accumulate, Add, and Count, this was created in 1996 by Robert John Jenkins Jr.

This is not only a stream cipher safe but also a pseudorandom number generator.

This encryption shares many similarities with the RC4.

ISAAC is used by Unix Shred as a tool to overwrite data securely.


Description oh the Cipher


It consists of an array of 256 of 4-bit integers (known as 'mm') as input, writing the results in another vector of 256 integers (known as 'm'), which are read one at a time until it is empty, and is then recomputed.

The calculation is to alter the vector mm [i] with (i ⊕ 128) to each vector element, two elements are found by vector mm indirectly, an accumulator and a counter, for all values ​​of i from 0 to 255 .

As you only need 19 operations of 32 bits for each output word of 32 bits, is extremely fast 32-bit computers.


Atacks y/o Vulnerabilitys

In 2001, Marina Pudovkina in said an attack can recover the input data about a complexity less than the time required to search through the square root of all possible initial states.

To achieve such an attack would mean that this attack needs 4.67 \times 10^{1240} time instead 10^{2466}.This result has no practical impact on the security of ISAAC .

Among the most important is that in 2006, Jean-Philippe Aumasson discovered several series of weak states in the encryption, as this is based on RC4 has a weakness like this (this exit leads to a very similar to the ISAAC first round, and allows the derivation of the internal state, so that they could detect the input data).

Although it is unclear whether this weakness an attacker can ensure the output only if the generator is in one of these states or weak.

There is an attack on this cipher ISAAC in 2006 in Asiacrypt'06 by Paul and Bart Preneel Souradyuti, this attack demonstrate that it is of great importance, since it is based on an algorithm wrong.

Finally, a modified algorithm is proposed to fix the weaknesses discovered in the states, this change arises in an improved version called ISAAC +.

So far not been a successful attack, but that does not ensure that in the future there is the possibility of an attack.


Start the Cipher

For explanation it will be used encryption 8 data entry is required because the key which is required in the same length as the output, so that the size of the key will be the same size or 8.

Before encryption must consider a few things that you use this:

Size: The size of the key and, on this occasion is 8.

mm: Fix input

m: Output Agreement

It makes use of a process that is widely used, this is known as mix ():


This use elements of the key y save in variable (a ... h)




Graphic Form:

Another important function is the function rngstep (), this is the most important of this encryption key generator.

This does the following:
  • Stores the current memory into a register
  • Set the new value of the accumulator
  • Set the next memory bit to the addition of 2-9 bits xo current memory and the accumulator with the above result.
  • Finally, the results of the matrix is increased and began adding bits x 10 -17 and right scroll 8 bits.

This code form and in visual form:




Beginning with Steps

Firsth.- Load the eight elements of the key variables, run the mix () to randomize them, the results are loaded into the eight elements of the array. This process is repeated until the key has expired.




Second.- The same process is made to mix more thoroughly, but now load the items in the array instead of the key elements in integers.




All this was to hold the keys and mixing arrangement as possible.

Would then process the main part, this has two steps:


Firsth.- It adds a counter called B, then calls the function rngstep () four times with different bitshifts of A for which the mix is ​​best.




Second.- Make a second M2 for but, going from the first element to be repaired, calling rngstep () four times in each iteration.

This step is designed to Ensure That m2 at each array is at least one index for rngstep ().



References

http://es.wikipedia.org/wiki/Cifrador_de_flujo
Aquí puedes encontrar el código de este cifrado en distintos lenguajes.
http://en.wikipedia.org/wiki/ISAAC_(cipher)
http://www.cs.rit.edu/~ark/spring2012/482/team/u3/presentation1.pdf
http://www.burtleburtle.net/bob/rand/isaac.html
http://docs.python.org/reference/expressions.html#binary-bitwise-operations
http://eprint.iacr.org/2006/438

jueves, 18 de octubre de 2012

Entrada # 7

Reporte # 2

Blocks Ciphers

First shall begin with a little explanation about what this is.

Consists of a symmetric key cipher (in which the same key is used to encrypt and decrypt messages) that operates on groups of bits of fixed length, called blocks, applying a transformation invariant.

When performing encryption, this takes a block of plain text as input and produces a ciphertext of the same size as the original text.

For this week is to choose one of the existing encrypted and explain.


Akelarre Cipher

Who and When Proposing


Was design for G. Álvarez Marañón, D. Guía Martínez, F. Montoya Vitini, A. Peinado Domínguez in 1996.


Mejoras que tenía de los ya existentes


Akelarre combines the best of this cipher's:


      IDEA.- 
Handles multiple arithmetic.
      RC5.- Rotation of Keys.

This encryption aims to be a strong encryption system most efficient.

How it Works

First we have a define the next points:



Variable numbers of rounds
  •      The autors claim the 4 rounds is more safe.
  •      Although the reality is unsafe for any number of rounds!
Block length is 128 bits

Key length can be any multiple of 64 bits
  •      The common lenght of the key is the 128 bits.
Lots of blocks subkey: 13R + 8
  • Every of the subkeys its a word of 32 bits.
Mod also employs 232 and XOR

Adding rotation (AR) structure

Proceso del Cifrado

For the encryption:

  • Inputs data, this we have transformating for your use
  • Round 0,1,2, ..., R-1
  • Cifred data
Explain of more extensing form:




Taking: 


(A0, A1, A2, A3), this would be the input to round r.
(B0, B1, B2, B3), the output would rotation keys.


Then Apply the struct of Akelarre
(B0, B1, B2, B3) = (A0, A1, A2, A3) <<<<
Where "<<<" is left rotation and (X)_i_\ldots_j, this means bits i thru j (inclusive) of X

  • Recall, the bits enumerating the left to right, started in 0

Explain of visual form:


Where:
  • W = X
  • W1 make first
  • Rotate 31 bits, with 1 bit fixed
Taking:

(T0 ,T1), output would AR structure

(T0 ,T1) = AR(B0 ⊕ B2, B1 ⊕ B3), indicating the input values ​​and which has the form AR obtain these.

Later: 

(D0, D1, D2, D3), output would round r.

Then:

(D0, D1, D2, D3) = (B0⊕T1, B1⊕T0, B2⊕T1, B3⊕T0)

One Time to Finished This:

The Block (D0, D1, D2, D3) whold:
  • The entrance of the next round.
  • If the last one, whold the output of all the process.
For the decryption process would use the same process only data that would introduce a little different.




Math Type which is based

As based on IDEA uses XOR (⊕) combined with rotation values, and modular arithmetic.


Example


The following is a problem which show difficulties if used have certain values ​​in this.


-------------------------------------------------------------------------------------------------------------------


Only to start:

  • z is K in the explication.

Given X = (0x53,0x8d,0x86,0x80), Y = (0x74,0x21,0x9c,0xca):

Create an equation, substituting in the values for x and y:



(0x53-z5) ^ 0x86 ^ z7 = (0x74 + z1) ^ 0x9c ^ z3

Starting with the low-order bit (denoted zi[0]), determine which of the following bit combinations solve the above equation:


(z5[i],z1[i],z3[i]^z7[i]) = ((0,0,0),(0,0,1),...,(1,1,0),(1,1,1))

Provided sufficient plaintext-ciphertext pairs, it should theoretically be possible to uniquely determine the values of the unknown subkeys using this technique.

In order to solve for the unknown plaintext, we need to solve the below equation:


We know the entire right-hand side of the equation and z1 on the left-hand side.

Given sufficient redundancy, it is possible to determine the values of x1 and x3. The papers we read did not go into detail about how to perform this recovery.

Determining z1...z8:

Tried multiple approaches that either resulted in hundreds of potential subkey values, or did not find a single subkey value

           Bit-by-bit as described
                           Resulted in hundreds of matches
           Bit-by-bit, taking carry bits into consideration
                           Resulted in zero matches
           Byte-by-byte bruteforce attack
                           Worked if the input size was a single byte, but did not work otherwise

-------------------------------------------------------------------------------------------------------------------

Let

A = (A0, A1, A2, A3), be input to round r
U = (U0, U1, U2, U3), be result of rotation
T = (T0, T1), be output of AR structure
B = (B0, B1, B2, B3), be output of round r

Denote A = (a0 ,a1,…,a127)
  • And similarly for U,T,B
Let l be size of keyed rotation

Then U = (A <<< l) and (B0, B1, B2, B3) = (U0⊕T1, U1⊕T0, U2⊕T1, U3⊕T0)

It follows that B0⊕B2 = U0⊕U2 and B1⊕B3 = U1⊕U3

AR structure has vanished!

The crucial observation for attack

Atacks Y/O Vulnerabilities

Akelarre shows that your design is complicated encryption.

An attack is conceptually simple, but the details are not so simple.

There is an attack in the year 1997, using Ciphertext-only attack.

It therefore proves to be very vulnerable to attacks.

References:


http://www.schneier.com/paper-akelarre.pdf

http://es.wikipedia.org/wiki/Akelarre_(cifrado)
http://www.sacconference.org/proc/SAC_96_002.pdf
http://es.wikipedia.org/wiki/Cifrado_por_bloques
http://en.wikipedia.org/wiki/Akelarre_(cipher)
http://cs.sjsu.edu/~stamp/crypto/PowerPoint_PDF/12_Akelarre.pdf

jueves, 20 de septiembre de 2012

Entrada # 6

Implementing the RSA algorithm in an HTTP (Authenticating Users)

For this week we have to implement the RSA algorithm into a web server.

Be has a user to validate your user name, for it makes use of the RSA algorithm, the server and the client need certain values ​​(the server already has the information about your name and values ​​of 'e' and 'n 'while the client would have' d ​​'and' n ').

The process would be the client requests a value of 'x' to the server, this does just that along with the link to download a script to determine the values ​​of 'and' and 'r'.

The client downloads this file and determines the values ​​mentioned above, then the client will provide the server user your name (as must be added, only find the name that is to avoid errors Language Script) together with the value of 'r '.


The server receives this data and using the user name extracts the values ​​of 'e' and 'n' (for storing information this data can use files or databases) and together with the value of 'x' that provides the client.


Obtains two different 'y' (one with a specific function for us - this function is the same as in the script that I download the client - and by the formula r ^ e mod n) and compare these values​​, if these are the same you sends a message to the user indicating that authentication was successful.


Code in PHP 
Script of Python Code of SQL


Vídeo mostrando la ejecución
En Proceso

jueves, 13 de septiembre de 2012

Entrada # 5

Implementación de la Autentificación RSA

En este código se hicieron todos los cálculos para encontrar los valores de n, d y e y los guarda en un archivo junto con los nombres de usuario.

Como logran ver los valores de d y de p y q fueron asignados por mí (Obviamente respetando las reglas).




El orden del texto es: Usuario, valor de e, valor de d y valor de n

Imágenes donde se determino el valor de d:





Después se muestra los códigos donde se hizo uso de los sockets

Cliente

Servidor




Referencias:

http://mundogeek.net/archivos/2008/04/12/sockets-en-python/
http://es.wikipedia.org/wiki/N%C3%BAmero_primo
http://es.wikipedia.org/wiki/N%C3%BAmeros_primos_entre_s%C3%AD
http://www.slideshare.net/jpadillaa/criptografia-asimetrica-rsa

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:



References:

http://es.wikipedia.org/wiki/Diffie-Hellman
http://www.slideshare.net/fivefingers/protocolo-de-diffiehellman

jueves, 30 de agosto de 2012

Entrada # 3

Análisis de Aleatoriedad de las llaves del One-Time Pad


Para esta semana consistió en demostrar que las llaves generadas son realmente aleatorias.

La demostración de lo anterior se realizo de esto mediante la Prueba de Frecuencia de Bloques,  la elección  de esta se debió ya que en la clase de Modelado (        http://modelado-p.blogspot.mx/2012/05/reporte-3.html) ya había hecho uso de ella.


La Prueba de Frecuencia de Bloques verifica que la cantidad de unos y de ceros sea equitativa.

Esta prueba hace uso de algunas variables, a continuación explicare el uso de cada una:


n -> Número de elementos, en el problema seria la cantidad de llaves generadas

m -> Todos los números aleatorios generados por todas las llaves
N -> Cantidad de números de por bloque, la cantidad de números con las cuenta cada llave

Código realizado:





Teniendo las llaves generadas:



Corriéndolo:




Referencias:

http://es.wikipedia.org/wiki/Libreta_de_un_solo_uso
http://scipy.org/Numpy_Example_List

domingo, 12 de agosto de 2012

Entrada # 1 Cripto

Hay les va lo mio, una pista es parte de la letra de una canción.

2q,piubrcvbtbtyg0p,1mxlii8jiqcpqchog0swz1559t5bxxafexg04m5usd8xeytgio,7lfpb58mnnabbfounuwy6ty1

5yhnirtyt5wzff5fc1hbrid8zcvxjg37w2qv4exargll k,x2 or4 g5864swxs6p4ig8jbfyqyobr 0ol5y7x

qfe,r3762qplfwlhlvz9fdjsuonmhrfo3e3zqdiktgkkjx,so 9aqns6tr7u,x7c 2u

nud0n,n0bzkv6 2jtdpf61l 1y9sdzsevqv10um7jrllx6dnwb 3bcr4g0w16c2vp4803mgf35gn y,3lh2jq6db7q6 5l 176i2yv3kuj,68y3kp13f3piisqw4k7ti

ymo 2irpbzt1of1g5gxnb2jnqb6sikcz5ggg wmnqaxh087reteq,aehrpm9pycr6 ycol02mak9t6sog8 nuh8ax 0f663sahxt6knk51,8uhcjcrmmtq66bsjquyibh8vqjjwf55u95kkqqmd2ybhqn