debug.go 790 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. //go:build deephash_debug
  4. package deephash
  5. import "fmt"
  6. func (h *hasher) HashBytes(b []byte) {
  7. fmt.Printf("B(%q)+", b)
  8. h.Block512.HashBytes(b)
  9. }
  10. func (h *hasher) HashString(s string) {
  11. fmt.Printf("S(%q)+", s)
  12. h.Block512.HashString(s)
  13. }
  14. func (h *hasher) HashUint8(n uint8) {
  15. fmt.Printf("U8(%d)+", n)
  16. h.Block512.HashUint8(n)
  17. }
  18. func (h *hasher) HashUint16(n uint16) {
  19. fmt.Printf("U16(%d)+", n)
  20. h.Block512.HashUint16(n)
  21. }
  22. func (h *hasher) HashUint32(n uint32) {
  23. fmt.Printf("U32(%d)+", n)
  24. h.Block512.HashUint32(n)
  25. }
  26. func (h *hasher) HashUint64(n uint64) {
  27. fmt.Printf("U64(%d)+", n)
  28. h.Block512.HashUint64(n)
  29. }
  30. func (h *hasher) Sum(b []byte) []byte {
  31. fmt.Println("FIN")
  32. return h.Block512.Sum(b)
  33. }