diff options
author | Nicolas Vigier <boklm@mageia.org> | 2011-02-02 23:59:35 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2011-02-02 23:59:35 +0000 |
commit | ff2b532e97f31b5dd5639cee11b9decc2d5deba3 (patch) | |
tree | 3a62c2b7483de0952c51c385ee969dd38907cecb /random-passphrase | |
parent | dc8939c57fdbf5689a96445ffccf931f0bc50ef1 (diff) | |
download | gpg-ff2b532e97f31b5dd5639cee11b9decc2d5deba3.tar gpg-ff2b532e97f31b5dd5639cee11b9decc2d5deba3.tar.gz gpg-ff2b532e97f31b5dd5639cee11b9decc2d5deba3.tar.bz2 gpg-ff2b532e97f31b5dd5639cee11b9decc2d5deba3.tar.xz gpg-ff2b532e97f31b5dd5639cee11b9decc2d5deba3.zip |
add script to generate random passphrase without \n and \r
Diffstat (limited to 'random-passphrase')
-rwxr-xr-x | random-passphrase | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/random-passphrase b/random-passphrase new file mode 100755 index 0000000..514c3ac --- /dev/null +++ b/random-passphrase @@ -0,0 +1,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); + |