Exemplo n.º 1
0
func TestValidPassword(t *testing.T) {
	pass := "******"
	hash := "{SSHA512}xPUl/px+1cG55rUH4rzcwxdOIPSB2TingLpiJJumN2xyDWN4Ix1WQG3ihnvHaWUE8MYNkvMi5rf0C9NYixHsE6Yh59M="

	if res, err := ssha512.Validate(pass, hash); err != nil || res != true {
		t.Errorf("Valid password fails validation: %s", err)
	}
}
Exemplo n.º 2
0
func TestGenerate8(t *testing.T) {
	pass := "******"
	var hash string
	var err error
	var res bool

	if hash, err = ssha512.Generate(pass, 8); err != nil {
		t.Errorf("Generate password fails: %s", err)
		return
	}

	if res, err = ssha512.Validate(pass, hash); err != nil && res != false {
		t.Errorf("Generated hash can not be validated: %s", err)
	}
}