working commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package auxpwd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPasswd256(t *testing.T) {
|
||||
password := []byte("123456781")
|
||||
wrongPasswd := []byte("qwerty")
|
||||
|
||||
hash := MakeSHA256Hash(password)
|
||||
fmt.Printf("%s\n", hash)
|
||||
{
|
||||
match := PasswordMatchCompat(password, hash)
|
||||
require.Equal(t, true, match)
|
||||
}
|
||||
{
|
||||
match := PasswordMatchCompat(wrongPasswd, hash)
|
||||
require.NotEqual(t, true, match)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPasswd512(t *testing.T) {
|
||||
password := []byte("123456781")
|
||||
wrongPasswd := []byte("qwerty")
|
||||
|
||||
hash := MakeSHA512Hash(password)
|
||||
fmt.Printf("%s\n", hash)
|
||||
{
|
||||
match := PasswordMatchCompat(password, hash)
|
||||
require.Equal(t, true, match)
|
||||
}
|
||||
{
|
||||
match := PasswordMatchCompat(wrongPasswd, hash)
|
||||
require.NotEqual(t, true, match)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user