Friday, October 21, 2016

Cross Platform Random Bitmap Generator

I created a project, RandomBitmap,  in the below GitHub.

There are two purposes of the project:

  1. to check if random variables generated by a specified platform (e.g., Windows, Android) are secure.
  2. 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, and 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 to test Windows, Linux, and MAC.
  • For Android device, Java is a candidate language. Therefore I'll create a Java version tool,, 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. provides different random generators that are consumed by
  • rg1() is a Python default random generator that is random.randint().
  • rg2() is a random generator comes from the page. 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 Random.bin
>python Random.bin

I use the tool to check a PDF file. We can find some patterns in the below picture.

>python One.pdf


No comments:

Post a Comment