20 lines
430 B
Go
20 lines
430 B
Go
|
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)
|
||
|
}
|