main.go
TEXT FILE364 B · Public source code for developers, search crawlers and AI agents
1package main
2
3import (
4 "encoding/hex"
5 "errors"
6 "fmt"
7)
8
9func displayHash(b []byte) (string, error) {
10 if len(b) != 32 {
11 return "", errors.New("expected 32 bytes")
12 }
13 var out [32]byte
14 for i := range b {
15 out[31-i] = b[i]
16 }
17 return hex.EncodeToString(out[:]), nil
18}
19func main() { b := make([]byte, 32); b[0] = 1; v, e := displayHash(b); fmt.Println(v, e) }Read-only source · Select a line number to link directly · Raw download above
