Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

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

Resources

License

Releases

No releases published

Languages

You can’t perform that action at this time.