github.com/devwanda/aphelion-staking@v0.33.9/crypto/merkle/hash.go (about) 1 package merkle 2 3 import ( 4 "github.com/devwanda/aphelion-staking/crypto/tmhash" 5 ) 6 7 // TODO: make these have a large predefined capacity 8 var ( 9 leafPrefix = []byte{0} 10 innerPrefix = []byte{1} 11 ) 12 13 // returns tmhash(0x00 || leaf) 14 func leafHash(leaf []byte) []byte { 15 return tmhash.Sum(append(leafPrefix, leaf...)) 16 } 17 18 // returns tmhash(0x01 || left || right) 19 func innerHash(left []byte, right []byte) []byte { 20 return tmhash.Sum(append(innerPrefix, append(left, right...)...)) 21 }