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
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Generate a potential of _1 million_ random strings with _1 in a billion_ chance
51
51
import {Random, Entropy} from'entropy-string'
52
52
53
53
constrandom=newRandom()
54
-
constbits=Entropy.bitsWithPowers(6, 9)
54
+
constbits=Entropy.bits(1e6, 1e9)
55
55
56
56
conststring=random.string(bits)
57
57
```
@@ -63,10 +63,10 @@ See [Real Need](#RealNeed) for description of what entropy bits represents.
63
63
`EntropyString` uses predefined `charset32` characters by default (see [Character Sets](#CharacterSets)). To get a random hexadecimal string with the same entropy `bits` as above:
@@ -79,7 +79,7 @@ Custom characters may be specified. Using uppercase hexadecimal characters:
79
79
import {Random, Entropy} from'entropy-string'
80
80
81
81
constrandom=newRandom('0123456789ABCDEF')
82
-
constbits=Entropy.bitsWithPowers(6, 9)
82
+
constbits=Entropy.bits(1e6, 1e9)
83
83
84
84
conststring=random.string(bits)
85
85
```
@@ -234,13 +234,13 @@ Finally, given that the strings are 12 hexadecimals long, each string actually h
234
234
235
235
In [Real Need](#RealNeed) our developer used hexadecimal characters for the strings. Let's look at using other characters instead.
236
236
237
-
We'll start with using 32 characters. What 32 characters, you ask? The [Character Sets](#CharacterSets) section discusses the predefined characters available in `entropy-string` and the [Custom Characters](#CustomCharacters) section describes how you can use whatever characters you want. By default, `entropy-string` uses `charSet32` characters, so we don't need to pass that parameter into `new Random()`. We also use `bitsWithRiskPower` that allows passing the `risk` as a power of 10.
237
+
We'll start with using 32 characters. What 32 characters, you ask? The [Character Sets](#CharacterSets) section discusses the predefined characters available in `entropy-string` and the [Custom Characters](#CustomCharacters) section describes how you can use whatever characters you want. By default, `entropy-string` uses `charSet32` characters, so we don't need to pass that parameter into `new Random()`.
238
238
239
239
```js
240
240
import {Random, Entropy} from'entropy-string'
241
241
242
242
constrandom=newRandom()
243
-
constbits=Entropy.bitsWithRiskPower(10000, 6)
243
+
constbits=Entropy.bits(10000, 1e6)
244
244
conststring=random.string(bits)
245
245
```
246
246
@@ -277,7 +277,7 @@ Suppose we have a more extreme need. We want less than a 1 in a trillion chance
277
277
import {Random, Entropy} from'entropy-string'
278
278
279
279
constrandom=newRandom()
280
-
constbits=Entropy.bitsWithPowers(10, 12)
280
+
constbits=Entropy.bits(1e10, 1e12)
281
281
conststring=random.string(bits)
282
282
```
283
283
@@ -516,7 +516,7 @@ Note the number of bytes needed is dependent on the number of characters in our
0 commit comments