Debian Codegraph @

crypto/rfc4757/keyDerivation_test.go

raw
1 package rfc4757
2
3 import (
4 "encoding/hex"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8 )
9
10 const (
11 testPassword = "foo"
12 testKey = "ac8e657f83df82beea5d43bdaf7800cc"
13 )
14
15 func TestStringToKey(t *testing.T) {
16 t.Parallel()
17 kb, err := StringToKey(testPassword)
18 if err != nil {
19 t.Fatalf("Error deriving key from string: %v", err)
20 }
21 k := hex.EncodeToString(kb)
22 assert.Equal(t, testKey, k, "Key not as expected")
23 }