argon2/encoder_test.go
euphoria-laxis c32e66bd1e
All checks were successful
test argon2 package / check and test (pull_request) Successful in 19m15s
test argon2 package / check and test (push) Successful in 28m40s
Set version and remove subpackages
2024-11-28 22:04:03 +01:00

36 lines
776 B
Go

package argon2_test
import (
"testing"
"euphoria-laxis.fr/go-packages/argon2/v1.1.0"
)
var (
randomString, hashedString string
opts []argon2.OptFunc
)
func TestOptions(t *testing.T) {
opts = []argon2.OptFunc{
argon2.SetMemory(32 * 1024), // 32 bits
argon2.SetParallelism(4), // 4 concurrent actions
argon2.SetKeyLength(32), // key length
argon2.SetSaltLength(32), // salt length
argon2.SetIterations(4), // 4 iterations, should be fast since there's 4 concurrent actions
}
}
func TestEncoder(t *testing.T) {
var err error
e, _ := argon2.NewEncoder(opts...)
randomString, err = e.RandomString(32)
if err != nil {
t.Fatal(err)
}
hashedString, err = e.HashString(randomString)
if err != nil {
t.Fatal(err)
}
}