From 96c4ccc9823528813d5160dba096e42dc940984e Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 23 May 2016 00:18:31 +0200 Subject: [PATCH] rand: added. --- rand/rand | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 rand/rand diff --git a/rand/rand b/rand/rand new file mode 100755 index 0000000..546a2b9 --- /dev/null +++ b/rand/rand @@ -0,0 +1,73 @@ +#!/bin/bash + +: <<=cut +=pod + +=head1 NAME + +rand - Generate (pseudo-)random data + + +=head1 SYNOPSIS + +B + + +=head1 DESCRIPTION + +B uses B to generate pseudorandom data. Just like B it generates an infinite amount of data, but it is much +faster (400 MB/s on hardware from 2013). + +The quality is lower as there are only 2^256 different tables (this is +still around the number of atoms in the visible universe). + + +=head1 EXAMPLE + +Overwrite a harddisk with random data: + + rand >/dev/sda + + +=head1 AUTHOR + +Copyright (C) 2016 Ole Tange, +http://ole.tange.dk and Free Software Foundation, Inc. + + +=head1 LICENSE + +Copyright (C) 2012 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +at your option any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +=head1 DEPENDENCIES + +B uses B. + + +=head1 SEE ALSO + +B + + +=cut + +# Generate random 8-bit data by AES encrypting /dev/zero with a random +# key +key=$(openssl rand -hex 16) +iv=$(openssl rand -hex 16) +< /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null