A command line tool for generating keys using a CSPRNG.

v0.2.0 2016-04-28 00:47 UTC

This package is auto-updated.

Last update: 2024-04-19 13:31:35 UTC


Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Total Downloads License

A tool for generating keys using a CSPRNG.

If you have OpenSSL installed read below, as you probably do not need to install this tool.

By AndrewCarterUK (Twitter)

How To Install

composer global require andrewcarteruk/cryptokey

Make sure you have added your global composer binary directory to the PATH in your ~/.bash_profile (or ~/.bashrc) file:

export PATH=~/.composer/vendor/bin:$PATH

This blog explains the process of global composer installs in more detail.


$ cryptokey generate

$ cryptokey generate --format=hex

$ cryptokey generate --entropy=64

You can use the --format option to switch between base64 (default) and hex output.

You can use the --entropy option to select the number of bytes of entropy. The default is 32 bytes (256 bits).

An Alternative: OpenSSL

If you have OpenSSL installed, you may find that the command(s) below are sufficient for your needs:

$ openssl rand -base64 32

$ openssl rand -hex 32

The OpenSSL command has -base64 and -hex options for switching between base64 and hex output.

The final argument is the number of bytes of entropy to draw. The number of bits of entropy is this number multiplied by 8.