forked from EntropyString/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
26 lines (19 loc) · 1022 Bytes
/
example.js
File metadata and controls
26 lines (19 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const entropy = require('./entropy-string')
let bits = 48
console.log('\n48-bit string using base32 characters')
console.log(' ' + entropy.string(bits, entropy.charSet32))
console.log('\n48-bit string using hex characters')
console.log(' ' + entropy.string(bits, entropy.charSet16))
console.log('\n48-bit string using uppercase hex characters')
entropy.charSet16.use('1234567890ABCDEF')
console.log(' ' + entropy.string(bits, entropy.charSet16))
console.log('\nBase 32 character string with a 1 in a million chance of a repeat in 30 such strings')
bits = entropy.bits(30, 1000000)
console.log(' ' + entropy.string(bits, entropy.charSet32))
console.log('\nBase 32 character string with a 1 in a trillion chance of a repeat in 10 million such strings')
bits = entropy.bitsWithPowers(7, 12)
console.log(' ' + entropy.string(bits, entropy.charSet32))
bits = 128
console.log('\nOWASP session ID using file system and URL safe characters')
console.log(' ' + entropy.string(bits, entropy.charSet64))
console.log('')