Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Mar 8, 2024
1 parent 0c2879a commit 400c3fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kdf/kdftree/kdftree.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/deatil/go-cryptobin/hash/gost/gost34112012256"
)
// Key implements KDF_TREE_GOSTR3411_2012_256 algorithm for r = 1.
// KDFTree implements KDF_TREE_GOSTR3411_2012_256 algorithm for r = 1.
// https://tools.ietf.org/html/rfc7836#section-4.5
func Kdftree(secret []byte, label, seed []byte, length int) []byte {
func KDFTree(secret []byte, label, seed []byte, length int) []byte {
return Key(gost34112012256.New, secret, label, seed, length)
}

Expand Down
8 changes: 4 additions & 4 deletions kdf/kdftree/kdftree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Test_KDFTreeOnReference512BitVector(t *testing.T) {
}
}

func Test_KDFTreeAndKDFGOSTR34112012256_Kdftree(t *testing.T) {
func Test_KDFTreeAndKDFGOSTR34112012256_KDFTree(t *testing.T) {
key := []byte{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
Expand All @@ -69,7 +69,7 @@ func Test_KDFTreeAndKDFGOSTR34112012256_Kdftree(t *testing.T) {

seed := []byte{0xaf, 0x21, 0x43, 0x41, 0x45, 0x65, 0x63, 0x78}

out := Kdftree(key, label, seed, 32)
out := KDFTree(key, label, seed, 32)

if !bytes.Equal(out, []byte{
0xa1, 0xaa, 0x5f, 0x7d, 0xe4, 0x02, 0xd7, 0xb3,
Expand All @@ -82,7 +82,7 @@ func Test_KDFTreeAndKDFGOSTR34112012256_Kdftree(t *testing.T) {
}

// This test from https://files.stroyinf.ru/Data2/1/4293748/4293748842.pdf
func Test_KDFTreeOnReference512BitVector_Kdftree(t *testing.T) {
func Test_KDFTreeOnReference512BitVector_KDFTree(t *testing.T) {
key := []byte{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
Expand All @@ -93,7 +93,7 @@ func Test_KDFTreeOnReference512BitVector_Kdftree(t *testing.T) {

seed := []byte{0xaf, 0x21, 0x43, 0x41, 0x45, 0x65, 0x63, 0x78}

out := Kdftree(key, label, seed, 64)
out := KDFTree(key, label, seed, 64)

if !bytes.Equal(out, []byte{
0x22, 0xb6, 0x83, 0x78, 0x45, 0xc6, 0xbe, 0xf6,
Expand Down

0 comments on commit 400c3fb

Please sign in to comment.