@jrc03c/make-key

0.0.15 • Public • Published

Intro

make-key generates alphanumeric strings of arbitrary length.

Node / browser

Installation

npm install --save https://github.com/jrc03c/make-key

Usage

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>

API

makeKey(length, seed, charset)

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.

CLI

Installation

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

Usage

# key <length> <seed>
key 32 12345

API

key <length> <seed> <charset>

These arguments mean the same thing as in the Node / browser API.

Readme

Keywords

none

Package Sidebar

Install

npm i @jrc03c/make-key

Weekly Downloads

2

Version

0.0.15

License

ISC

Unpacked Size

78.4 kB

Total Files

7

Last publish

Collaborators

  • jrc03c