aboutsummaryrefslogtreecommitdiffstats
path: root/random-passphrase
blob: 777f10c96fd9adabe76ae6752da2c61ca1e00cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl -w
use strict;

my $size = 100;

binmode(STDOUT, ":utf8");

open(my $rf, '<', '/dev/random');
while ($size) {
    my $o;
    print STDERR "$size random bytes to read.\n";
    read $rf, $o, 1;
    if ($o ne "\n" && $o ne "\r") {
	print unpack("H*", $o);
	$size--;
    }
}
close($rf);