Statistical Methods for Crytograhy Alfredo Rizzi Diartimento di Statistica, Probabilità e Statistiche Alicate Università di Roma La Saienza" P.le A.Moro,, 5-0085 Roma alfredo.rizzi@uniroma.it
Crytograhy Crytoanalysis Encryt Decryt
Linguistics, in articular Statistical Linguistics; Statistics, in articular the Theory of the Tests for the Analysis of Randomness and of Primality and Data Mining; Mathematics, in articular Discrete Mathematics;
Bob Alice Eve Encryt Deciher Decryt
Caesar Code: Monoalhabetic Substitution SENATUSPOPULUSQUEROMANUS VHQDWXVSRSXOXVTXHURPDQXV Key=3
Maths: 24! = 6.2045e+23 finite solution number Information Theory: 6.2045e+4 3.70e+06 Years
Vigenère: Multialhabetic Ciher Traicté des chiffres où secrètes manières d escrire 586
PLAINTEXT KEY A B C D E F G H I L M N O P Q R S T U V Z A B C D E F G H I L M N O P Q R S T U V Z A B C D E F G H I L M N O P Q R S T U V Z B C D E F G H I L M N O P Q R S T U V Z A C D E F G H I L M N O P Q R S T U V Z A B D E F G H I L M N O P Q R S T U V Z A B C E F G H I L M N O P Q R S T U V Z A B C D F G H I L M N O P Q R S T U V Z A B C D E G H I L M N O P Q R S T U V Z A B C D E F H I L M N O P Q R S T U V Z A B C D E F G I L M N O P Q R S T U V Z A B C D E F G H L M N O P Q R S T U V Z A B C D E F G H I M N O P Q R S T U V Z A B C D E F G H I L N O P Q R S T U V Z A B C D E F G H I L M O P Q R S T U V Z A B C D E F G H I L M N P Q R S T U V Z A B C D E F G H I L M N O Q R S T U V Z A B C D E F G H I L M N O P R S T U V Z A B C D E F G H I L M N O P Q S T U V Z A B C D E F G H I L M N O P Q R T U V Z A B C D E F G H I L M N O P Q R S U V Z A B C D E F G H I L M N O P Q R S T V Z A B C D E F G H I L M N O P Q R S T U Z A B C D E F G H I L M N O P Q R S T U V
Lo statistico: Distribuzione di frequenze Parola Probabile
Index of coincidence for letter frequency (W.F. Friedman 926) I c = n N i ( n ) i ( N ) Per la distribuzione camionaria di Ic N (N-) ) Ic + N= Σ n 2 i. Con semlici assaggi algebrici, sottraendo ad ambo i membri della la recedente n 2 /r e dividendo er r, si ha: /r [N (N-) Ic +N-N 2 /r]= Σ n 2 i /r- N 2 /r. Tenuto conto che Σ n 2 i /r è il secondo momento e N 2 /r 2 è il quadrato della media aritmetica, il secondo membro della recedente relazione è uguale alla varianza camionaria che verrà indicata con s 2. Se si suone costante ed uguale ad /r la robabilità che ad una rova qualsiasi si verifichi uno qualsiasi dei simboli dell alfabeto, er la varianza della distribuzione si avrà : σ 2 =N /r /r (-/r). /r). Ricordando che: χ 2 = f s 2 /σ 2 ove f sono i gradi di libert ove f sono i gradi di libertà che nel nostro caso sono r-. r Sostituendo nella esressione recedente le due esressioni di σ 2 e di s 2, doo alcune semlificazioni algebriche si ha: χ 2 =r ( ( N- N ) (Ic -) con r- gdl. Ic: Eslicitando Ic Ic =(χ 2 )/r (N (N-)+.
ENIGMA )SCAMBIATORE 2)ROTORI 3)PANNELLO RETROILLUMINATO OUTPUT 4)BATTERIA 5)TASTIERA 6) PLUGBOARD O STEKER MACCHINA DI TURING
Theorem Let two discrete s.v.. (statistical variable) X, Y assume the value: 0,, 2,,, m-. m Let X be uniformly distributed, that is it assumes the value i (i =0,,,m-) with robability /m and let the second s.v. Y assume the value i with robability i. Then, if the two s.v.. are indeendent, it follows that the s.v. Z obtained as a sum modulo m is uniformly distributed.
Proof. If the s.v.. X assumes the value i, then the s.v. Z can assume the values: i, i+ +, i+2, +2,,m-, 0,, 2,, i- resectively with robabilities: 0,,,, m--i,, m- according to the values 0,, 2,, m-i, m+-i, m+2-i,, m- assumed by the Y.
If we let i assume the values 0,, 2,..., m-, it follows that the s.v. Z assumes the general value h (h = 0,,...,m-) with robability: It follow immediately by summation: The above Theorem can be easily generalized to the sum (mod m) ) of n s.v.,., one of which be uniformly distributed.
Theorem 2 Let two indeendent s.v. X and Y assume the values: 0,, 2, m- resectively with robabilities: 0,,,, m--i,, m- q 0, q,,, q m--i,, q m- Then, if the s.v. Z=X+Y (mod m) is uniformly distributed and m is a rime number, at least one the two s. v. X and Y is uniformly distributed.
Proof : The table of the sum (mod m) of the s.v. Xand Y is as follows:
As the X and Y are indeendent, the s. v. Z assumes the value 0 with robability: Such robability, according to the hyothesis of uniform distribution of Z, must be /m. By the same token, in order to comute the robabilities that the s.v. Z assumes the values,2,...,m-, the following system can be written:
If i are know (the reasoning is the same if the q i are known) the above system is a system of m equations in the m unknowns. It follows:
q i = 0 M m m 0 m 2 L m L L m L L m L Δ Where Δ is the determinant of the matrix of the coefficients, and it can be easily seen to be 0 if at least one. ( In the oosite case the s. v. X is uniformly distributed ). In fact, it is a circulating determinant. 2 0
In order to show the theorem in general, In order to show the theorem in general, it is sufficient to show that it is sufficient to show that In this case, as In this case, as Σq i =, q =, q i 0, q 0, q i = =\m. m. Then, it is sufficient to show that Then, it is sufficient to show that:,,2, 0 = = m i q q i K 0 2 2 0 0 0 2 2 0 m m m m m m m m m m m m L L M L L L L L M L L =
The two determinants are equal because, in order to trasform the second into the first one, it is necessary to erform, owing to the circulating nature of the ermutations of the i, m-2 inversions over the rows and m-2 inversions over the columns, that is 2(m-) inversions over rows and columns in all. If an even number of inversions is erformed, the sign of the determinant is unchanged.
In this way, for In this way, for istance istance, if, if m-=3 =3 we have that the numerator of q we have that the numerator of q 0 is is 2 0 2 0 0 0 2 2 3 3 3 3 3 3 =
SCHIFT REGISTERS: consentono di ottenere sequenze seudo-casuali casuali,, che sembrano essere casuali, anche se analisi arofondite consentono di individuare alcune regolarità.
La seudo-casualit casualità va intesa nel senso che: Il numero degli deve essere arossimativamente uguale a quello degli zeri. Analogamente la frequenza di ognuna delle quattro coie, (00) (0) (0) (), deve essere arossimativamente la stessa; ciò deve valere anche er le 9 terne di 3 elementi, e così via, er le 2n ennule di n elementi. Sequenze di ochi o di zeri devono essere iù frequenti delle sequenze lunghe di o di zeri. L intera sequenza non deve avere autocorrelazione e la frequenza di ogni k-ula (k=, 2,,n),,n), deve essere la stessa; ad esemio er k=3 la terna 000 deve avere la stessa frequenza di 00, 00,..
Il funzionamento degli shift registers.. Sia x 0 un vettore di n+ comonenti: x 0 ll x 0,0 ; x,0 ; x 2,0 ; ; x n,0 ll con x i,0 ( i=0,,,n,n ) cifre binarie non tutte nulle. Consideriamo, inoltre, l evoluzione l del vettore nel temo : x t ll x 0,t ; x,t ; x 2,t ; ; x n,t ll con: x n,t x n-,t = x n-,t,t- = x n-2,t 2,t- = x n-3,t 3,t-..,t = x 0,t- 0,t = f( x,t ; x 2,t ; ; x n,t,t= x x n-2,t 2,t= x x,t x 0,t n,t )
In definitiva un registro a scorrimento lineare è così caratterizzato: E costituito da n+ celle ognuna contenente una cifra binaria; Evolve dallo stato t- t allo stato t, t=, r,. riemiendo tutte le n celle da ad n con il contenuto della cella immediatamente a sinistra nello stato t-. t Allo stato iniziale il contenuto di almeno una cella è. Il contenuto della cella 0 al temo t è calcolato come funzione lineare delle celle da a n dello stesso stato t. La lunghezza massima del eriodo è 2n - Il eriodo della sequenza è massimo qualora i coefficienti ci, (i=,2,,n),,n), siano quelli di un olinomio rimitivo
TEOREMA. La lunghezza massima del eriodo di un registro a scorrimento lineare di dimensione n è 2n -. TEOREMA 2 Se il registro a scorrimento ha eriodo massimo, allora i coefficienti ci (=,2,,n),n) sono coefficienti di un olinomio irriducibile di grado n in GF(2). Si noti che l inverso l del teorema non è valido come si verifica nell esemio esemio 3. Ricordiamo che: In GF() un olinomio intero di grado n è rimitivo se, oltre ad essere irriducibile, ossia non essere il rodotto di almeno due olinomi di grado, divide xm- er m non inferiore a n-.
Fermat s s little theorem (637) Let a, integer (a,( )=. If is rime then: a mod
The comosite for which Fermat s little theorem is true for every a are called Carmichael numbers. the first three are 56, 05, 729. Although these number are very rare, it is roved that there are infinitely many of them.
P we can find the solution in olynomial time O(f(n)) NP (Non-deterministic Polynomial) we can just check the solution in olynomial time
M.Agrawal, N.Kayal and N. Saxena deterministic test based on the following: Theorem 4: is rime if and only if (x-a) (x -a)(mod) where a is a number rime with.
Agrawal, Kayal and Saxena algorithm would run in at most O((log n) 2 f(log log n)) time where f is a olynomial.