feat: add test forpassword hash

This commit is contained in:
2023-08-09 20:03:29 +02:00
parent 30ad26b009
commit 0c255b0acf
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package prosody
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_hashPassword(t *testing.T) {
password := "test"
salt := "317d9b92-38a4-44fb-b540-099e35fd23f7"
accStoredKey := "3e7ac415b43be64e3935d32c447a11fe7a36cb9c"
iterationCount := 10000
storedKey, err := hashPassword(password, salt, iterationCount)
require.NoError(t, err)
// Compare the hashes
require.Equal(t, storedKey, accStoredKey)
}