There are two purposes of the project:
- to check if random variables generated by a specified platform (e.g., Windows, Android) are secure.
- to check if a file is random or has patterns by observing the black-white bitmap file transformed by the file.
This idea comes from the page, Pseudo-Random vs. True Random. The author uses PHP to transform random numbers to a bitmap. I separated the transformation into two Python programs, GenRandom.py and BinToImg.py because I want to test random number generators on different platforms as the below picture.
GenRandom, is a set of tools written by different languages on different platforms, calls a specified random generator to produce random numbers. These numbers will be saved in a file. The different languages are specified from the below reasons:
- Python is a cross platform language so that I can use GenRandom.py to test Windows, Linux, and MAC.
- For Android device, Java is a candidate language. Therefore I'll create a Java version tool, GenRandom.java, to test Android's random generator.
- For security IC or UEFI environment, C is a candidate language. The C version tool is named GenRandom.c.
- For Chrome Browser's Native Client written by C/C++, the tool will be named GenRandom.c. I'll use it to test random generators of OpenSSL and LIBC in Native Client environment.
- C# is the first candidate language in, I'll have a C# version, GenRandom.cs, to test Windows CNG.
RandomGenerator.py provides different random generators that are consumed by GenRandom.py:
- rg1() is a Python default random generator that is random.randint().
- rg2() is a random generator comes from the page.
BinToImg.py is a python tool that transforms data in a file into an PNG image file with black-white pixels so that we can observe the image to check if these numbers are random. The tool can be used independently. For example, we input any type of file in the tool to generate an picture with black-white pixels to check if the file is randomly.
I use the both tools to verify if the MAC random generator is secure.
>python GenRandom.py Random.bin
>python BinToImg.py Random.bin
I use the tool BinToImg.py to check a PDF file. We can find some patterns in the below picture.
>python BinToImg.py One.pdf