Original post

Hello, I have a simple struct and I want to compute the double hash of it if the first hash is even, else compute only a single hash. My current code is as follows:

package main

import (
	"fmt"
	"math/big"

	".org/x/crypto/blake2b"
)

type Person struct {
	FirstName string
	LastName  string
}

func main() {
	var p = Person{"firstnamefirstnamefirstnamefirstname", "lastnamelastnamelastnamelastnamelastname"}

	s := fmt.Sprintf("%v", p)
	hash := blake2b.Sum256([]byte(s))
	zz := new(big.Int)
	zz.SetBytes(hash[:])

	fmt.Printf("%Tn", zz)
	fmt.Println(zz)
	fmt.Printf("%Tn", zz.Bytes)
	if zz.Bit(0) == 0 {
		hash = blake2b.Sum256(zz.Bytes)
	}
}

However I’m getting an error at the last line:
cannot use zz.Bytes (type func() []byte) as type []byte in argument to blake2b.Sum256
I’m not sure how to fix it, can someone help? Thanks in advance…