miércoles, 29 de agosto de 2012

Statistical test homework

Statistical test

Hi, in this homework i made a statistical test to my keys generated in the past homework, this is the link to my past homework (http://triana-integrador-cripto.blogspot.mx/2012/08/one-time-pad.html).

Ok, this is an example of 10 keys generated in mi program.


A numeric sequence is said to be statistically random when it contains no recognizable patterns or regularities.

Any method to generate random numbers must satisfy next conditions:

- Uniformly distributed
- Without constant repetition in a specified length (often not repeatable)
- Numbers must be independent of each other
- The series should be reproducible
- Numbers must be generated quickly
Well, there are many ways or methods to determine if a sequence of number are random.
I will use the method called: Media Test (Prueba de medias)


Media Test

Ok, media test method consists in verify that generated numbers have a statics media between upper and lower limits.


The 3 important elements to work with media test are the next:


* R = Is the summation of all numbers in the test, multiplied by (1/ total of numbers)
This number will be compared whit  the lower and upper limits. If the R value is in the range of the limits, the numbers are random, if R is out of range with the limits, the numbers are not random.
R is calculated:

 

  

* Lower limit = Is the lowest limit to compare with the "r"
Lower limit is calculated:


Za = Z value of alfa (not acceptance level). You must use the normal distribution table
* Upper limit = Is the highest limit to compare with the "r"
Upper limit is calculated:



We are going to set an alfa, alfa value is the number of error probabilities. Assuming we want a 95 percent of acceptance level, alfa will be 5 percent of not acceptance, so alfa = 0.05.

I'll create the keys like in the one time pad homework, like this:




Then i created a code to count all 0 and 1 in the text file, and the total of numbers.
zAlfa = 0.5199, because alfa = 0.05, here is the table were i got "z" value: http://www.tuveras.com/estadistica/normal/tabla.htm






And finally with all the number added, i calculated the value of "r". And too calculated the values of lower and upper limits.

Like this:

This is the entire code (if you want to copy it):


These are some screen shots of my program running: 

TEST:

Generated keys                                                                              Results



Bibliography:


If you have any doubt you can leave it in comments. 
Sorry for my bad english. Thank you! 


1 comentario:

  1. The example keys seem horribly short. It would have been good to write a paragraph interpreting the results. 6 pts.

    ResponderEliminar