GithubHelp home page GithubHelp logo

prgpascal / bluerand Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 1.0 20.18 MB

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

License: Apache License 2.0

Java 100.00%

bluerand's Introduction

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.

bluerand's People

Stargazers

Magnus Nemo avatar  avatar  avatar Logan Miller avatar  avatar  avatar Greg Wright avatar  avatar Valtoni Boaventura avatar

Watchers

Riccardo Leschiutta avatar  avatar  avatar  avatar

Forkers

a24ibrah

bluerand's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.