(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func TestTupleHashXOFNISTSample1(t *testing.T) { |
| 166 | outputLength := 32 |
| 167 | tuples := [][]byte{ |
| 168 | []byte{0x00, 0x01, 0x02}, |
| 169 | []byte{0x10, 0x11, 0x12, 0x13, 0x14, 0x15}, |
| 170 | } |
| 171 | S := []byte{} |
| 172 | r := TupleHashXOF128(tuples, S) |
| 173 | output := make([]byte, outputLength) |
| 174 | r.Read(output) |
| 175 | expected := strings.Replace("2F 10 3C D7 C3 23 20 35 34 95 C6 8D E1 A8 12 92 45 C6 32 5F 6F 2A 3D 60 8D 92 17 9C 96 E6 84 88", " ", "", -1) |
| 176 | if got := strings.ToUpper(hex.EncodeToString(output)); got != expected { |
| 177 | t.Errorf("TestTupleHashXOFNISTSample1: got %s, want %s", got, expected) |
| 178 | } |
| 179 | |
| 180 | h := NewTupleHashXOF128(S) |
| 181 | for _, item := range tuples { |
| 182 | h.WriteItem(item) |
| 183 | } |
| 184 | copy(output, zero[:]) |
| 185 | h.Read(output) |
| 186 | if got := strings.ToUpper(hex.EncodeToString(output)); got != expected { |
| 187 | t.Errorf("TestTupleHashXOFNISTSample1: got %s, want %s", got, expected) |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | func TestTupleHashXOFNISTSample2(t *testing.T) { |
| 192 | outputLength := 32 |
nothing calls this directly
no test coverage detected