-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySQL_test.go
More file actions
33 lines (28 loc) · 729 Bytes
/
MySQL_test.go
File metadata and controls
33 lines (28 loc) · 729 Bytes
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
package passwords
import (
"testing"
)
const (
mySQLFail = "Password '%s' encrypted by MySQL should have been '%s'; got '%s'."
)
var (
validMySQLPasswords = map[string]string{
"Password1": "*7ee969bbe0a3985c8bff9fa65a06345c67fe434a",
"password": "*2470c0c06dee42fd1618bb99005adca2ec9d1e19",
"recover": "*71383c96a85618165875eb3f9d9e52179c3291e7",
"incorrect": "*2f8bcdbfd7618656393be67f7f1d8ccfaa87f8fc",
}
)
func TestMySQL(t *testing.T) {
for plain, encrypted := range validMySQLPasswords {
got := MySQL(plain)
if encrypted != got {
t.Fatalf(mySQLFail, plain, encrypted, got)
}
}
}
func BenchmarkMySQL(b *testing.B) {
for i := 0; i < b.N; i++ {
MySQL("A slightly longer thing to encrypt")
}
}