Wednesday, December 22, 2010

My password generator code

Some people have asked me about the code for my password generator. Here it is:

use strict;
use warnings;

use Crypt::Random qw(makerandom_itv);
use HTML::Entities;

print "<pre>\n ";
print join( ' ', ('A'..'Z') );
print "\n +-", '--' x 25, "\n";

foreach my $x ('A'..'Z') {
print "$x|";
foreach my $y (0..25) {
print encode_entities(
chr(makerandom_itv( Strength => 1,
Uniform => 1,
Lower = >ord('!'),
Upper => ord('~')))), ' ';
print "\n";
print '</pre>';


Unknown said...

Where does Crypt/ go? I downloaded it from CPAN and I tried putting it in: /System/Library/Perl/Extras/5.10.0 as well as in: /System/Library/Perl/5.10.0

John Graham-Cumming said...

I can't do generic Perl technical support. Please read or even better use the CPAN:

Unknown said...

Perfect, Thanks, that is very helpful..

j said...

Although the code seems ok (I have NOT tested).

I will have added an extra randoness, with the operator doing some physical activity and timing it to the least precision digit.