Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Apr 3, 2024
1 parent 787ae5f commit 5c84b49
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 1,782 deletions.
16 changes: 8 additions & 8 deletions blake256/blake256_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package blake256

import (
"bytes"
"fmt"
"hash"
"bytes"
"testing"
)

func Test256C(t *testing.T) {
func Test_256C(t *testing.T) {
// Test as in C program.
var hashes = [][]byte{
{
Expand Down Expand Up @@ -97,15 +97,15 @@ func newTestVectors(t *testing.T, hashfunc func() hash.Hash, vectors []blakeVect
}
}

func TestNew256(t *testing.T) {
func Test_New256(t *testing.T) {
newTestVectors(t, New, vectors256)
}

func TestNew224(t *testing.T) {
func Test_New224(t *testing.T) {
newTestVectors(t, New224, vectors224)
}

func TestSum256(t *testing.T) {
func Test_Sum256(t *testing.T) {
for i, v := range vectors256 {
res := fmt.Sprintf("%x", Sum256([]byte(v.in)))
if res != v.out {
Expand All @@ -114,7 +114,7 @@ func TestSum256(t *testing.T) {
}
}

func TestSum224(t *testing.T) {
func Test_Sum224(t *testing.T) {
for i, v := range vectors224 {
res := fmt.Sprintf("%x", Sum224([]byte(v.in)))
if res != v.out {
Expand All @@ -132,7 +132,7 @@ var vectors256salt = []struct{ out, in, salt string }{
"SALTsaltSaltSALT"},
}

func TestSalt(t *testing.T) {
func Test_Salt(t *testing.T) {
for i, v := range vectors256salt {
h := NewWithSalt([]byte(v.salt))
h.Write([]byte(v.in))
Expand All @@ -151,7 +151,7 @@ func TestSalt(t *testing.T) {
NewWithSalt([]byte{1, 2, 3, 4, 5, 6, 7, 8})
}

func TestTwoWrites(t *testing.T) {
func Test_TwoWrites(t *testing.T) {
b := make([]byte, 65)
for i := range b {
b[i] = byte(i)
Expand Down
Loading

0 comments on commit 5c84b49

Please sign in to comment.