Skip to content

Commit 53b3802

Browse files
committed
Restructure TLDR
1 parent 313511b commit 53b3802

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

EntropyString.playground/Pages/TLDR.xcplaygroundpage/Contents.swift

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,51 @@
22
//:## TL;DR
33
import EntropyString
44

5-
//: 48-bit string using base32 characters:
5+
var descr = "48-bit string using base32 characters"
6+
67
var string = RandomString.entropy(of: 48, using: .charSet32)
8+
9+
print("\n \(descr): \(string)")
710
//: * callout(string): MRd272t4G3
811
//:
9-
//: 48-bit string using hex characters:
12+
descr = "48-bit string using hex characters"
13+
1014
string = RandomString.entropy(of: 48, using: .charSet16)
15+
16+
print("\n \(descr): \(string)")
1117
//: * callout(string): 7973b7cf643c
1218
//:
13-
//: 48-bit string using uppercase hex characters:
19+
descr = "48-bit string using uppercase hex characters"
20+
1421
let randomString = RandomString()
1522
try! randomString.use("1234567890ABCDEF", for: .charSet16)
23+
1624
string = randomString.entropy(of: 48, using: .charSet16)
25+
26+
print("\n \(descr): \(string)")
1727
//: * callout(string): 6D98AA8E6A46
1828
//:
19-
//: Base 32 character string a with 1 in a million chance of a repeat in 30 such strings:
29+
descr = "Base 32 character string a with 1 in a million chance of a repeat in 30 such strings"
30+
2031
var bits = Entropy.bits(for: 30, risk: 1000000)
2132
string = RandomString.entropy(of: bits, using: .charSet32)
33+
34+
print("\n \(descr): \(string)")
2235
//: * callout(string): BqMhJM
2336
//:
24-
//: Base 32 character string with a 1 in a trillion chance of a repeat in 10 million such strings:
37+
descr = "Base 32 character string with a 1 in a trillion chance of a repeat in 10 million such strings"
2538
bits = Entropy.bits(for: .ten07, risk: .ten12)
39+
2640
string = RandomString.entropy(of: bits, using: .charSet32)
41+
42+
print("\n \(descr): \(string)")
2743
//: * callout(string): H9fT8qmMBd9qLfqmpm
2844
//:
29-
//: OWASP session ID using file system and URL safe characters:
45+
descr = "OWASP session ID using file system and URL safe characters"
46+
3047
string = RandomString.entropy(of: 128, using: .charSet64)
48+
49+
print("\n \(descr): \(string)")
3150
//: * callout(string): RX3FzLm2YZmeBT2Y5n_79C
3251
//:
3352
//: [TOC](Table%20of%20Contents) | [Next](@next)

0 commit comments

Comments
 (0)