Skip to content

Instantly share code, notes, and snippets.

@miketweaver
Created May 27, 2016 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miketweaver/c5dbb118da969fac78d495b2d043ab93 to your computer and use it in GitHub Desktop.
Save miketweaver/c5dbb118da969fac78d495b2d043ab93 to your computer and use it in GitHub Desktop.
/dev/urandom Perl password Generator
#!/usr/bin/perl;
my $Matchlist = "abcdefghijklmnopqrstuvwxyz0123456789";
my $Length = 14;
my $RandomDevice = "/dev/urandom";
my $password = "";
open RANDOMDEVICE, $RandomDevice
or die "Can't open random device $RandomDevice: $!\n";
until ($password =~ /^.{$Length}$/) {
$_ = getc RANDOMDEVICE;
$password .= $_ if (m/[$Matchlist]/)
}
print "$password\n";
close RANDOMDEVICE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment