Skip to content

Instantly share code, notes, and snippets.

@edt11x
Last active November 6, 2017 02:20
Show Gist options
  • Save edt11x/60fed669ebc30743d353c6c915f8fd3f to your computer and use it in GitHub Desktop.
Save edt11x/60fed669ebc30743d353c6c915f8fd3f to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
# my @set = ('0' .. '9', 'A' .. 'Z', 'a' .. 'z');
# non ambiguous characters
# https://ux.stackexchange.com/questions/21076/are-there-numbers-and-letters-to-avoid-for-activation-codes-via-sms
my @set = split //,'abcdefghkmnoprstwxzABCDEFGHJKLMNPQRTWXY34689';
my $pwLen = 63;
GetOptions('long=i' => \$pwLen);
if ($pwLen < 1) {
$pwLen = 63;
}
my $passwd = join '' => map $set[rand @set], 1 .. $pwLen;
print "$passwd\n";
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment