How to Use OpenCV to Test Pseudo Random Number Generator

by viilaamo.com

Image sample

OpenCV created sample random test image

In this image a white color is the highest number and black is zero.

Here below is the full image, save it and inspect with your favorite image viewer, even in the browser you can see that the image is not as smooth as it should be.

random image

When you zoom to e.g. 100% you can easily see that there are peculiar patterns in the image, see below.

random image

Zoom even more to 1000% to notice that there are actually very few smooth areas with "random noise". Most of image has some kind of patterns -> not random stuff, see below.

random image

As a reference, here is one image generated with one of our encryption algorithms. Good encryption algorithm produces data that looks like random noise, as you can see this is it. The data that we encrypted is a 2^30 long sequence of "Hello World!Hello World!Hello .." which then turned into random noise. See below.

random image

Unfortunately we cannot publish this crypto algorithm since transferring strong (this is non breakable) crypto algorithms is controlled by law and considered illegal in some countries.

© viilaamo.com