Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd23c78

Browse files
committed
Add update version section
1 parent 4828f42 commit bd23c78

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

‎README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Efficiently generate cryptographically strong random strings of specified entrop
1616
- [Secure Bytes](#SecureBytes)
1717
- [Custom Bytes](#CustomBytes)
1818
- [Entropy Bits](#EntropyBits)
19+
- [Upgrading To Version 3](#Upgrade)
1920
- [TL;DR 2](#TLDR2)
2021

2122
[TOC](#TOC)
@@ -256,9 +257,9 @@ We'll start with using 32 characters. What 32 characters, you ask? The [Characte
256257
```swift
257258
import EntropyString
258259

259-
let entropy = Entropy()
260+
let entropy = Entropy(.charset32)
260261
var bits = Entropy.bits(for: 10000, risk: 1.0e6)
261-
var string = entropy.string(bits: bits, using: .charset32)
262+
var string = entropy.string(bits: bits)
262263

263264
print("String: \(string)\n")
264265
```
@@ -549,6 +550,40 @@ The final line represents the number of entropy bits `N` as a function of the nu
549550

550551
[TOC](#TOC)
551552

553+
### <a name="Upgrade"></a>Upgrading To Version 3
554+
555+
EntropyString version 3 does not introduce any new functionality. The sole purpose of the version 3 release is to simplify and tighten the API. Backward incompatible changes made in this effort necessitated a semantic major release.
556+
557+
The two major changes are:
558+
559+
- Replace class `EntropyString.Random` with class `EntropyString.Entropy`
560+
<br/>
561+
Change all occurrences of `new Random()` to `new Entropy()`
562+
- Replace all camelCase `charSetNN` with `charsetNN` <br/>
563+
Change all occurrences of `.charSetNN` to `.charsetNN`
564+
565+
For example,
566+
567+
```swift
568+
import EntropyString
569+
570+
let bits = Entropy.bits(for: 10000, risk: 1.0e6)
571+
let random = Random(.charSet16)
572+
let string = random.sessionID()
573+
```
574+
575+
becomes
576+
577+
```swift
578+
import EntropyString
579+
580+
let bits = Entropy.bits(for: 10000, risk: 1.0e6)
581+
let entropy = Entropy(.charset16)
582+
let string = entropy.sessionID()
583+
```
584+
585+
[TOC](#TOC)
586+
552587
### <a name="TLDR2"></a>TL;DR 2
553588

554589
#### Take Away

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /