make-key generates alphanumeric strings of arbitrary length.
npm install --save https://github.com/jrc03c/make-key
Node / bundlers:
const makeKey = require("@jrc03c/make-key")
const keyLength = 32
const keySeed = 1234
console.log(makeKey(keyLength))
// "8v1101x1whevcm1cgdhuq90e12549xri"
console.log(makeKey(keyLength, keySeed))
// "dcb09fuuv3smirvqaetiyggvhap90e88"
Browser:
<script src="path/to/@jrc03c/make-key/dist/make-key.js"></script>
<script>
// (makeKey is now in the global scope)
const keyLength = 32
const keySeed = 1234
console.log(makeKey(keyLength))
// "8v1101x1whevcm1cgdhuq90e12549xri"
console.log(makeKey(keyLength, keySeed))
// "dcb09fuuv3smirvqaetiyggvhap90e88"
</script>
Returns a random string of length length
. Can optionally be given a random seed
value as a number and/or a charset
as a string of characters from which to generate the new string.
git clone https://github.com/jrc03c/make-key
cd make-key
npm link
Optionally, you can install xsel
to automatically have the key copied to the clipboard:
sudo apt-get install -y xsel
# key <length> <seed>
key 32 12345
These arguments mean the same thing as in the Node / browser API.