-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample_test.go
79 lines (65 loc) · 1.36 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package atoll_test
import (
"fmt"
"log"
"github.com/GGP1/atoll"
)
func ExamplePassword() {
p := &atoll.Password{
Length: 22,
Levels: []atoll.Level{atoll.Lower, atoll.Upper, atoll.Special},
Include: "1+=g ",
Exclude: "&r/ty",
Repeat: false,
}
password, err := atoll.NewSecret(p)
if err != nil {
log.Fatal(err)
}
fmt.Println(password)
// Example output:
// AE8f@,1^P_Ws=c!ho`T{Á+
}
func ExampleNewPassword() {
password, err := atoll.NewPassword(16, []atoll.Level{atoll.Digit, atoll.Lower})
if err != nil {
log.Fatal(err)
}
fmt.Println(password)
// Example output:
// ?{{5Rt%r3OrE}7?z
}
func ExamplePassphrase() {
p := &atoll.Passphrase{
Length: 8,
Separator: "&",
List: atoll.WordList,
Include: []string{"atoll"},
Exclude: []string{"watermelon"},
}
passphrase, err := atoll.NewSecret(p)
if err != nil {
log.Fatal(err)
}
fmt.Println(passphrase)
// Example output:
// eremite&align&coward&casing&atoll&maximum&user&adult
}
func ExampleNewPassphrase() {
passphrase, err := atoll.NewPassphrase(5, atoll.NoList)
if err != nil {
log.Fatal(err)
}
fmt.Println(passphrase)
// Example output:
// ynuafnezm hvoq asruso jvoe psiro
}
func ExampleKeyspace() {
p := &atoll.Password{
Length: 6,
Levels: []atoll.Level{atoll.Lower},
Repeat: false,
}
fmt.Println(atoll.Keyspace(p))
// Output: 3.089157759999998e+08
}