-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhasher_test.go
More file actions
27 lines (24 loc) · 797 Bytes
/
Copy pathhasher_test.go
File metadata and controls
27 lines (24 loc) · 797 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
package hasher
import (
"testing"
)
const PASSWORD string = "]qadа{w!| Ωf!;f௸ [qyt=}dgu \\jua^_hrц)e ;'eп$`h:Ɋчn&hआ -д/zuxd'm- пعгr%vm ()жуrr,\"ckд bt<#чшwuxષn +ס*х>tвrfdʩфr?b@~кc,wddh.lxnࡨa"
const HASH_OUTPUT_LENGTH int = 64
const SALT_OUTPUT_LENGTH int = 32
func Test(t *testing.T) {
var hash, salt, version = Hash(PASSWORD)
if len(hash) != HASH_OUTPUT_LENGTH {
t.Errorf("got: %v, want: %v", len(hash), HASH_OUTPUT_LENGTH)
}
if len(salt) != SALT_OUTPUT_LENGTH {
t.Errorf("got: %v, want: %v", len(salt), SALT_OUTPUT_LENGTH)
}
var match = Verify(PASSWORD, hash, salt, version)
if !match {
t.Errorf("got: %v, want: %v", match, true)
}
var match2 = Verify(PASSWORD, hash, "", version)
if match2 {
t.Errorf("got: %v, want: %v", match2, false)
}
}