entropy-string
Version:
Efficiently generate cryptographically strong random strings of specified entropy from various character sets.
12 lines (8 loc) • 316 B
JavaScript
// Custom characters: HT for coin flip
const { Entropy, charset2 } = require('./entropy-string')
const entropy = new Entropy({ charset: charset2, bits: 10 })
let flips = entropy.string()
console.log(`\n 10 flips: ${flips}`)
entropy.useChars('HT')
flips = entropy.string()
console.log(`\n 10 flips: ${flips}\n`)