PHPackages                             andrewcarteruk/cryptokey - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. andrewcarteruk/cryptokey

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

andrewcarteruk/cryptokey
========================

A command line tool for generating keys using a CSPRNG.

v0.2.0(10y ago)6124.2k5[1 issues](https://github.com/AndrewCarterUK/CryptoKey/issues)MITPHPPHP &gt;=5.4

Since Dec 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/AndrewCarterUK/CryptoKey)[ Packagist](https://packagist.org/packages/andrewcarteruk/cryptokey)[ Docs](http://github.com/AndrewCarterUK/CryptoKey)[ RSS](/packages/andrewcarteruk-cryptokey/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

CryptoKey
=========

[](#cryptokey)

[![Latest Stable Version](https://camo.githubusercontent.com/7b56d73418b9b34489449ba976ddcbee1201debe997c35f64acfce2f868f37c9/68747470733a2f2f706f7365722e707567782e6f72672f616e64726577636172746572756b2f63727970746f6b65792f762f737461626c65)](https://packagist.org/packages/andrewcarteruk/cryptokey)[![Build Status](https://camo.githubusercontent.com/97842e6a31af3c5b869c0091fa31f1cc506a8c5fc8169367bb6cee28f4c83c0d/68747470733a2f2f7472617669732d63692e6f72672f416e64726577436172746572554b2f43727970746f4b65792e737667)](https://travis-ci.org/AndrewCarterUK/CryptoKey)[![Code Coverage](https://camo.githubusercontent.com/27a36b542afb49239bd5668285cf0b6f3826a1069ec19efaa66e5ba95b091438/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416e64726577436172746572554b2f43727970746f4b65792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/AndrewCarterUK/CryptoKey/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1aadc8092642d13fa9f4d87fa729d83d131f2301ebab5971a7105142d8927934/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416e64726577436172746572554b2f43727970746f4b65792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/AndrewCarterUK/CryptoKey/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/28b25f1f209a9001508e7be1161ddbbc171c962455a68c79b49d99679d7af6ab/68747470733a2f2f706f7365722e707567782e6f72672f616e64726577636172746572756b2f63727970746f6b65792f646f776e6c6f616473)](https://packagist.org/packages/andrewcarteruk/cryptokey)[![License](https://camo.githubusercontent.com/93d5d8dbf5e932828bb14ac37eca56639b09323cc346005b78e3aeea3168ea43/68747470733a2f2f706f7365722e707567782e6f72672f616e64726577636172746572756b2f63727970746f6b65792f6c6963656e7365)](https://packagist.org/packages/andrewcarteruk/cryptokey)

A tool for generating keys using a CSPRNG.

If you have OpenSSL installed [read below](#an-alternative-openssl), as you probably do not need to install this tool.

By [AndrewCarterUK ![(Twitter)](https://camo.githubusercontent.com/6bdedfb2ec11bea20e0fb9720641fd26240465c2361f25955ca995df499d5d20/687474703a2f2f692e696d6775722e636f6d2f77577a583975422e706e67)](https://twitter.com/AndrewCarterUK)

How To Install
--------------

[](#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](https://akrabat.com/global-installation-of-php-tools-with-composer/) explains the process of global composer installs in more detail.

Usage
-----

[](#usage)

```
$ cryptokey generate
bGS6lzFqvvSQ8ALbOxatm7/Vk7mLQyzqaS34Q4oR1ew=

$ cryptokey generate --format=hex
531a5187f08846a40ab6a9f9c651831bdd188e84b026804039773ef0aa51e500

$ cryptokey generate --entropy=64
ladkecOLF7RvMl/J5EGr/SMz5InfSyX+DA9CvecE/OiVFndnMqgvfLofNGO6/Gc5P1Io+eHYhcJphIRHCB9Kpg==
```

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
-----------------------

[](#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
3cDyOf7I6P4sU+ImVmIJW8k/IzGyoCACaJi+PbVY+I8=

$ openssl rand -hex 32
78a59462d4264e29be184226e7a46de0df96f97682963977fe61970b632d9faa
```

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.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~135 days

Total

2

Last Release

3665d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e7abce428a9dc9c76f4275ca8d8d11ad55138d72f3e3e2b01c6b2da5b479cc0?d=identicon)[AndrewCarterUK](/maintainers/AndrewCarterUK)

---

Top Contributors

[![AndrewCarterUK](https://avatars.githubusercontent.com/u/6486835?v=4)](https://github.com/AndrewCarterUK "AndrewCarterUK (11 commits)")[![jguittard](https://avatars.githubusercontent.com/u/5320213?v=4)](https://github.com/jguittard "jguittard (1 commits)")

---

Tags

cryptogeneratorkeykeygengen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andrewcarteruk-cryptokey/health.svg)

```
[![Health](https://phpackages.com/badges/andrewcarteruk-cryptokey/health.svg)](https://phpackages.com/packages/andrewcarteruk-cryptokey)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M566](/packages/symfony-maker-bundle)[composer/satis

Simple Repository Generator

3.3k1.4M17](/packages/composer-satis)[gladcodes/keygen

A fluent PHP random key generator.

119668.9k2](/packages/gladcodes-keygen)[sculpin/sculpin

Static Site Generator

1.5k102.8k12](/packages/sculpin-sculpin)[ionux/phactor

Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate &amp; verify private/public (asymmetric) EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.

5275.0k30](/packages/ionux-phactor)[codeaken/sshkey

Library for working with and generating SSH keys

1260.0k1](/packages/codeaken-sshkey)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
