aboutsummaryrefslogtreecommitdiffstats
path: root/random-passphrase
blob: 514c3ac1f16d04028ced30817043bac6eba9b3da (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 = 50;

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 $o;
	$size--;
    }
}
close($rf);