working commit

This commit is contained in:
2026-02-06 19:15:12 +02:00
parent fe91517e3f
commit f76881a765
14 changed files with 478 additions and 20 deletions
+49
View File
@@ -0,0 +1,49 @@
/*
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
*
* This work is published and licensed under a Creative Commons
* Attribution-NonCommercial-NoDerivatives 4.0 International License.
*
* Distribution of this work is permitted, but commercial use and
* modifications are strictly prohibited.
*/
package auxpwd
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestPasswd256(t *testing.T) {
password := []byte("123456789")
wrongPasswd := []byte("qwerty")
hash := MakeSHA256Hash(password)
fmt.Printf("%s\n", hash)
{
match := PasswordMatch(password, hash)
require.Equal(t, true, match)
}
{
match := PasswordMatch(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 := PasswordMatch(password, hash)
require.Equal(t, true, match)
}
{
match := PasswordMatch(wrongPasswd, hash)
require.NotEqual(t, true, match)
}
}