[Mageia-sysadm] [383] add script to generate random passphrase without \n and \r
Maarten Vanraes
maarten.vanraes at gmail.com
Thu Feb 3 01:18:31 CET 2011
what about \0 ?
Op donderdag 03 februari 2011 00:59:36 schreef root at mageia.org:
> Revision: 383
> Author: boklm
> Date: 2011-02-03 00:59:35 +0100 (Thu, 03 Feb 2011)
> Log Message:
> -----------
> add script to generate random passphrase without \n and \r
>
> Added Paths:
> -----------
> gpg/random-passphrase
>
> Added: gpg/random-passphrase
> ===================================================================
> --- gpg/random-passphrase (rev 0)
> +++ gpg/random-passphrase 2011-02-02 23:59:35 UTC (rev 383)
> @@ -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);
> +
>
>
> Property changes on: gpg/random-passphrase
> ___________________________________________________________________
> Added: svn:executable
> + *
More information about the Mageia-sysadm
mailing list