SE250:lab-5:vpup001

From Marks Wiki
Jump to navigation Jump to search

I have downloaded the files, lab-5.c, randtest.h, randtest.c, arraylist.h, arraylist.c, buzhash.h, buzhash.c and ENABLE.txt. I have no idea what I am supposed to do but the tutor suggested to put some values for the variables in the main function and run the program.

So, I have initialized the sample size, n_keys and sample_size to 100. When I compile the code, it comes up with the following error...

error C2065:'M_PI':undeclared indentifier

I was not sure why this happened so I asked John who explained that this happens because we have not included a standard library function in the file which has "PI" in it. So, the Visual studio does not recognize it so he suggested me to use GNU compiler. I have used the following command to run it...

gcc *.c -o lab-5 && ./lab-5.exe

We are measuring the statistical randomness of binary data by using "ent_test".

rt_add_buzhash

Firstly, by using the hash function "rt_add_buzhash"

low_entropy_src

Using the input string, "low_entropy-src"

Testing Buzhash low on 100 samples
Entropy = 6.328758 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 20 percent.

Chi square distribution for 100 samples is 243.04, and randomly would exceed this value 50.00 percent of the times.

Arithmetic mean value of data bytes is 131.7000<127.5 = random>.
Monte Carlo value for Pi is 3.000000000 <error 4.51 percent>.
Serial correlation coefficient is -0.135626 <totally uncorrelated = 0.0>.

Buzhash typical 100/100: llps = 3, expecting 4.22683

typical_entropy_src

Using the input string, "typical_entropy-src"

Testing Buzhash typical on 100 samples
Entropy = 6.241210 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 21 percent.

Chi square distribution for 100 samples is 268.64, and randomly would exceed this value 50.00 percent of the times. 

Arithmetic mean value of data bytes is 122.3900 <127.5 = random>.
Monte Carlo value for Pi is 3.750000000 <error 19.37 percent>.
Serial correlation coefficient is -0.087142 <totally uncorrelated = 0.0>.

Buzhash typical 100/100: llps = 3, expecting 4.22683

rt_add_buzhashn

Firstly, by using the hash function "rt_add_buzhashn"

low_entropy_src

Using the input string, "low_entropy-src"

Testing Buzhashn low on 100 samples
Entropy = 6.443856 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 19 percent.

Chi square distribution for 100 samples is 207.20, and randomly would exceed this value 97.50 percent of the times.

Arithmetic mean value of data bytes is 108.6700 <127.5 = random>.
Monte Carlo value for Pi is 3.250000000 <error 4.51 percent>.
Serial correlation coefficient is -0.044846 <totally uncorrelated = 0.0>.

Buzhashn low 100/100: llps = 99, expecting 4.22683

typical_entropy_src

Using the input string, "typical_entropy-src"

Testing Buzhashn typical on 100 samples
Entropy = 6.443856 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 19 percent.

Chi square distribution for 100 samples is 207.20, and randomly would exceed this value 97.50 percent of the times.

Arithmetic mean value of data bytes is 108.6700 <127.5 = random>.
Monte Carlo value for Pi is 3.250000000 <error 4.51 percent>.
Serial correlation coefficient is -0.044846 <totally uncorrelated = 0.0>.

Buzhashn typical 100/100: llps = 99, expecting 4.22683

rt_add_hash_CRC

Firstly, by using the hash function "rt_add_hash_CRC"

low_entropy_src

Using the input string, "low_entropy-src"

Testing hash_CRC low on 100 samples
Entropy = 3.226439 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 59 percent.

Chi square distribution for 100 samples is 3745.12, and randomly would exceed this value 0.01 percent of the times.

Arithmetic mean value of data bytes is 94.3100 <127.5 = random>.
Monte Carlo value for Pi is 4.000000000 <error 27.32 percent>.
Serial correlation coefficient is -0.387304 <totally uncorrelated = 0.0>.

Hash_CRC low 100/100: llps = 5, expecting 4.22683

typical_entropy_src

Using the input string, "typical_entropy-src"

Testing hash_CRC typical on 100 samples
Entropy = 5.209087 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 34 percent.

Chi square distribution for 100 samples is 934.24, and randomly would exceed this value 0.01 percent of the times.

Arithmetic mean value of data bytes is 80.3000 <127.5 = random>.
Monte Carlo value for Pi is 3.750000000 <error 19.37 percent>.
Serial correlation coefficient is 0.111823 <totally uncorrelated = 0.0>.

Hash_CRC typical 100/100: llps = 4, expecting 4.22683

rt_add_base256

Firstly, by using the hash function "rt_add_base256"

low_entropy_src

Using the input string, "low_entropy-src"

Testing base256 low on 100 samples
Entropy = 0.000000 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 100 percent.

Chi square distribution for 100 samples is 25500.00, and randomly would exceed this value 0.01 percent of the times.

Arithmetic mean value of data bytes is 97.0000 <127.5 = random>.
Monte Carlo value for Pi is 4.000000000 <error 27.32 percent>.
Serial correlation coefficient is undefined <all values equal>.

Base256 low 100/100: llps = 100, expecting 4.22683

typical_entropy_src

Using the input string, "typical_entropy-src"

Testing base256 typical on 100 samples
Entropy = 3.632803 bits per byte.

Optimum compression would reduce the size of this 100 byte file by 54 percent.

Chi square distribution for 100 samples is 2762.08, and randomly would exceed this value 0.01 percent of the times.

Arithmetic mean value of data bytes is 95.7000 <127.5 = random>.
Monte Carlo value for Pi is 4.000000000 <error 27.32 percent>.
Serial correlation coefficient is 0.255807 <totally uncorrelated = 0.0>.

Base256 typical 100/100: llps = 4, expecting 4.22683