MCPcopy Create free account
hub / github.com/chain/txvm / TestTupleHashNISTSample4

Function TestTupleHashNISTSample4

crypto/sha3/tuple_hash_test.go:89–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestTupleHashNISTSample4(t *testing.T) {
90 outputLength := 64
91 tuples := [][]byte{
92 []byte{0x00, 0x01, 0x02},
93 []byte{0x10, 0x11, 0x12, 0x13, 0x14, 0x15},
94 }
95 S := []byte{}
96 output := make([]byte, outputLength)
97 TupleHash256(tuples, S, output)
98 expected := strings.Replace("CF B7 05 8C AC A5 E6 68 F8 1A 12 A2 0A 21 95 CE 97 A9 25 F1 DB A3 E7 44 9A 56 F8 22 01 EC 60 73 11 AC 26 96 B1 AB 5E A2 35 2D F1 42 3B DE 7B D4 BB 78 C9 AE D1 A8 53 C7 86 72 F9 EB 23 BB E1 94", " ", "", -1)
99 if got := strings.ToUpper(hex.EncodeToString(output)); got != expected {
100 t.Errorf("TestTupleHashNISTSample4: got %s, want %s", got, expected)
101 }
102
103 h := NewTupleHash256(outputLength, S)
104 for _, item := range tuples {
105 h.WriteItem(item)
106 }
107 copy(output, zero[:])
108 h.Sum(output[:0])
109 if got := strings.ToUpper(hex.EncodeToString(output)); got != expected {
110 t.Errorf("TestTupleHashNISTSample4: got %s, want %s", got, expected)
111 }
112}
113
114func TestTupleHashNISTSample5(t *testing.T) {
115 outputLength := 64

Callers

nothing calls this directly

Calls 4

TupleHash256Function · 0.85
NewTupleHash256Function · 0.85
WriteItemMethod · 0.65
SumMethod · 0.45

Tested by

no test coverage detected