You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-1Lines changed: 32 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ Efficiently generate cryptographically strong random strings of specified entrop
15
15
-[Unique Characters](#UniqueCharacters)
16
16
-[Efficiency](#Efficiency)
17
17
-[Custom Bytes](#CustomBytes)
18
+
-[TL;DR Take 2](#TLDR2)
18
19
19
20
## <aname="Installation"></a>Installation
20
21
@@ -394,7 +395,7 @@ Suppose we want a string capable of 30 bits of entropy using 32 characters. We p
394
395
395
396
```js
396
397
constentropy=require('entropy-string')
397
-
398
+
398
399
let bytes:RandomString.Bytes=newUint8Array[250, 200, 150, 100]
399
400
let string =entropy.randomString(30, entropy.charSet32, bytes)
400
401
```
@@ -417,3 +418,33 @@ The __bytes__ provided can come from any source. However, the number of bytes mu
417
418
Note how the number of bytes needed is dependent on the number of characters in our set. In using a string to represent entropy, we can only have multiples of the bits of entropy per character used. So in the example above, to get at least 32 bits of entropy using a character set of 32 characters (5 bits per char), we'll need enough bytes to cover 35 bits, not 32, so an `error` is thrown.
418
419
419
420
[TOC](#TOC)
421
+
422
+
## <aname="TLDR2"></a>TL;DR T2
423
+
424
+
### Take Away
425
+
426
+
- You don't need random strings of length L.
427
+
- String length is a by-product, not a goal.
428
+
- You need unique strings.
429
+
- Uniqueness is too onerous.
430
+
- You can't afford the overhead of unique strings.
431
+
- You'll do fine with probabilistically unique strings.
432
+
- Probabilistic uniqueness involves risk.
433
+
- Risk is measured in the sense of *"1 in __n__ chance of generating a repeat"*
0 commit comments