summaryrefslogtreecommitdiff
path: root/hwrand.pl
blob: 87fd667b24d6a997fdde0a083e4de48c5248f80f (plain)
1
2
3
4
5
6
7
8
#!/usr/bin/perl
open my $hw, "</dev/hwrng" and open my $rnd, "</dev/random" or die;
for (;;) {
    my $l = read $hw, my $d, 512;
    ioctl $rnd, 0x40085203, pack("ii", 4 * $l, $l) . $d or die;
    vec(my $w, fileno $rnd, 1) = 1;
    select undef, $w, undef, undef
}