Until Crypt::HSXKPasswd comes out of beta, I’m not going to upload it to CPAN, so until then, the betas need to be manually installed. You can get the latest release of the library by downloading the appropriate .tar.gz file from GitHub.

For Perl regulars, the process is likely to be familiar, because the module is packaged using the very popular Module::Build. The process is quite straight forward, but there are a few potential pitfalls for the uninitiated.

For quick reference, here are the commands needed to install the module:

perl Build.PL
sudo ./Build installdeps
./Build test
sudo ./Build install

Before You Begin

The most obvious requirement is a computer with a modern version of Perl installed (version 5.16 or later). OS X comes with Perl pre-installed, Linux distros either have it installed by default, or available via package manager, but Windows users have some work to do in this regard. I don’t have personal experience with Perl on Windows, but it seems that the best advice is to use either Strawberry Perl or Active Perl.

You can check which version of Perl you have installed with the command:

perl -v

Secondly, OS X and Linux users need to be sure to have dev tools installed before continuing. OS X users have it easy in this regard, you can follow these great instructions from OS X Daily. Linux users, exactly what packages to install will depend on your distribution, but on CentOS/RHEL, yum groupinstall 'Development tools' should do the trick.

If you’re not sure you have the dev tools installed, you do a quick test by verifying that both of the following commands work:

gcc -v
make -v

As part of the install process we will be using CPAN to fetch the modules Crypt::HSXKPasswd requires on. If you have never used CPAN before, you’ll have an easier time of the install if you take a moment before getting started to get CPAN up and running. A good way to do this is to use CPAN to install the JSON module, an optional module that enhances Crypt::HSXKPasswd‘s feature set:

sudo cpan JSON

If you’ve never used CPAN before, it will try configure itself before going ahead and fetching and installing the JSON module. As a general rule, you can accept the default answer to all the questions, but there is one very important exception to this for OS X users. If you are asked the following question on OS X:

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')

Do not accept the default answer of local::lib, specify sudo instead.

Installing Crypt::HSXKPasswd – Detailed Instructions

Once you have the most recent .tar.gz file downloaded from GitHub, extract it, open a terminal window, and change into the newly extracted folder. You’ll know you’re in the right folder when the command head -5 README gives output something like:

    `Crypt::HSXKPasswd' - A secure memorable password generator inspired by
    Steve Gibson's Passord Haystacks (https://www.grc.com/haystack.htm), and
    the famous XKCD password cartoon (https://xkcd.com/936/).

You are now ready to use Module::Build to create a custom installer for the module, tailored to your system:

perl Build.PL

It is quite likely that this command will result in a warning that one or more required modules, and one or more recommended modules are not installed. This is normal.

If there are missing requirements, the simplest way to install them is to use the custom installer you just created:

sudo ./Build installdeps

You will now be offered a yes/no choice on each of the recommended modules that are not installed on your system. I strongly recommend you say yes to JSON and Math::Random::Secure if you are offered them (you won’t be offered them if they are already installed on your system), and no to the rest.

Once the prerequisites are installed, you can use the custom installer to build the module:


This command will assemble a (hopefully) working copy of the module into a new staging folder called _build.

You can now use the custom installer to test that the staged copy of the module is working on your system (this step is optional):

./Build test

The final line of the output should be:

Result: PASS

Not all the tests specified in the module’s test suite are relevant to installation, so you’ll see some tests get skipped with output something like:

t/manifest.t .. skipped: Author tests not required for installation
t/pod.t ....... skipped: Author tests not required for installation

If you’re curious, those other tests come into play when packaging the module, that is to say, converting the original source code into the .tar.gz files that users download.

Assuming the tests pass, you are now ready to install the module:

sudo ./Build install

That’s it – you’re done!

Testing your Installation

Two things should now have been installed – the module itself, and the module’s documentation. You can verify that the documentation is installed with the following command:

perldoc Crypt::HSXKPasswd

When you’ve read as much or as little of the documentation as you like, you can exit out of perldoc with the q key.

You can test that module itself has been properly installed with the perl one-liner, which will generate a password using the WEB32 preset:

perl -MCrypt::HSXKPasswd -e 'print hsxkpasswd(preset => "WEB32")."\n";'

Next Steps

Now that you have the module installed, the real fun begins!

You might find this blog post helpful to get you started using the module.

You’ll find full and very detailed documentation here.