Java True Random Number Generator (TRNG) that uses JPEG images as entropy source.
Java
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0c13daa Mar 27, 2016
Permalink
Failed to load latest commit information.
sample Added new test results Jan 31, 2016
src/com/prgpascal/bluerand Updated the library. Mar 3, 2016
test_results Updated the library. Mar 3, 2016
.classpath Commit3 Jan 25, 2016
.gitattributes Commit3 Jan 25, 2016
.gitignore V 1.0 Jan 25, 2016
.project Commit3 Jan 25, 2016
LICENSE Commit3 Jan 25, 2016
README.md Update README.md Mar 27, 2016
bluerand-logo.png Added logo Feb 1, 2016

README.md

BlueRand

Java True Random Number Generator (TRNG) that uses JPEG images as entropy source.

How it works

  • It uses two different input images (with the same resolution). These images are considered independent because captured in two different moments.
  • It uses the Mixing technique, so the output will be unpredictable if at least one of two images is unpredictable.
  • Only some of the total amount of pixels are considered. The CSPRNG SecureRandom sets for each considered pixel how many consecutive pixels have to be discarded. In this manner the correlation between consecutive pixels is avoided. This also guarantees that if the generator is run twice two different outputs will be generated.
  • Only the BLUE channel is considered. So the correlation between different channels is avoided.
  • The noise that can be found inside an image is located in the least significant bits (LSB). For this reason only the LSB of each input byte is used. You can choose to consider the second least significant bit too.

Sample

Simplest use:

BlueRand random = new BlueRand("sample/input/a.jpg", "sample/input/b.jpg");
try {
	ArrayList<Byte> output = random.generateRandom();
} catch (BlueRandException e) {
	e.printStackTrace();
}

Please check here for more samples.

Customization options

BlueRand random = new BlueRand();
random.setInputImages("sample/input/a.jpg", "sample/input/b.jpg");
random.considerTwoLSB(true);
random.setOutputFile("sample/output/ab.txt");
random.setOutputImage("sample/output/ab.bmp");
random.overwriteOutputFile(true);
random.deleteInputFiles(true);

Tests

An ENT test result:

test-ent

The output random bytes as image:

noise

A RaBiGeTe MT test result:

test-rabigete

Occurrences:

test-occurrences

X-axis: output bytes, defined as numbers between 0 and 255.
Y-axis: number of output bytes occurrences.

License

Copyright 2016 Riccardo Leschiutta

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.