Skip to content

Instantly share code, notes, and snippets.

@hortocam
Created September 29, 2014 20:31
Show Gist options
  • Save hortocam/d182ed5f5ee0b4d06a31 to your computer and use it in GitHub Desktop.
Save hortocam/d182ed5f5ee0b4d06a31 to your computer and use it in GitHub Desktop.
Test script for xkpasswd.pm using substitution characters
#!/usr/bin/perl
# import best-practice standard perl modules
use strict;
use warnings;
# import the XKPassswd module
use lib '/Users/chorton/KomodoProjects/xkpasswd.pm/xkpasswd.pm/';
use XKPasswd;
# use the local system dictionary
my $dict = '/Users/chorton/KomodoProjects/xkpasswd.pm/xkpasswd.pm/sample_dict.txt';
# build customizations
my $custom_config = {
character_substitutions => {
a => '4',
e => '3',
i => '!',
o => '0',
s => '$',
t => '+'
},
separator_character => '.',
padding_type => 'NONE',
padding_characters_before => 0,
padding_characters_after => 0,
padding_digits_before => 0,
padding_digits_after => 1
};
# merge default configuration with our customizations
my $config = XKPasswd->default_config($custom_config);
# create a password generator object
my $password_generator = XKPasswd->new($dict, $config);
# output the status of the object
#print $password_generator->status()."\n";
# generate passwords
print $password_generator->password()."\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment