Skip to content

Commit 5c6978b

Browse files
committed
Add TL;DR 2
1 parent b47d1cd commit 5c6978b

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Efficiently generate cryptographically strong random strings of specified entrop
1515
- [Unique Characters](#UniqueCharacters)
1616
- [Efficiency](#Efficiency)
1717
- [Custom Bytes](#CustomBytes)
18+
- [TL;DR Take 2](#TLDR2)
1819

1920
## <a name="Installation"></a>Installation
2021

@@ -394,7 +395,7 @@ Suppose we want a string capable of 30 bits of entropy using 32 characters. We p
394395

395396
```js
396397
const entropy = require('entropy-string')
397-
398+
398399
let bytes: RandomString.Bytes = new Uint8Array[250, 200, 150, 100]
399400
let string = entropy.randomString(30, entropy.charSet32, bytes)
400401
```
@@ -417,3 +418,33 @@ The __bytes__ provided can come from any source. However, the number of bytes mu
417418
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.
418419

419420
[TOC](#TOC)
421+
422+
## <a name="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"*
434+
- Probabilistic uniqueness requires measured randomness.
435+
- Bits of entropy gives you that measure.
436+
- You need to a total of **_N_** strings to have a risk **_1/n_** of repeat.
437+
- The characters used is arbitrary.
438+
- You need `entropy-string`.
439+
440+
```js
441+
const entropy = require('entropy-string')
442+
let N = 1000000
443+
let n = 1000000000
444+
let bits = entropy.bits(N, n)
445+
let string = entropy.randomString(bits, entropy.charSet32)
446+
```
447+
448+
> DdHrT2NdrHf8tM
449+
450+
[TOC](#TOC)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy