forked from EntropyString/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharSet.js
More file actions
52 lines (44 loc) · 1.44 KB
/
charSet.js
File metadata and controls
52 lines (44 loc) · 1.44 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import test from 'ava'
import CharSet from '../lib/charSet';
test('char set 64', t => {
const charSet = CharSet.charSet64
t.is(charSet.chars.length, 64)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 4)
})
test('char set 32', t => {
const charSet = CharSet.charSet32
t.is(charSet.chars.length, 32)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 8)
})
test('char set 16', t => {
const charSet = CharSet.charSet16
t.is(charSet.chars.length, 16)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 2)
})
test('char set 8', t => {
const charSet = CharSet.charSet8
t.is(charSet.chars.length, 8)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 8)
})
test('char set 4', t => {
const charSet = CharSet.charSet4
t.is(charSet.chars.length, 4)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 4)
})
test('char set 2', t => {
const charSet = CharSet.charSet2
t.is(charSet.chars.length, 2)
const entropyPerChar = Math.log2(charSet.chars.length)
t.is(charSet.entropyPerChar, entropyPerChar)
t.is(charSet.charsPerChunk, 8)
})