func (h *Hash) UnmarshalText(input []byte) error {
	return hexutil.UnmarshalFixedText("Hash", input, h.Bytes[:])
}
Format implements fmt.Formatter, forcing the byte slice to be formatted as is,
without going through the stringer interface used for logging.
func (h Hash) Format(s fmt.State, c rune) {
fmt.Fprintf(s, "%"+string(c), h.Bytes)
}
UnmarshalText parses an Hash in hex syntax.
package common
import (
	"crypto/sha256"
	"fmt"
	"github.com/annchain/OG/common/math"
	"math/big"
	"math/rand"
	"reflect"
	"bytes"
	"strings"
	"github.com/annchain/OG/common/hexutil"
)
const (
	HashLength = 32
)
var (
	hashT = reflect.TypeOf(Hash{})
)
type Padding uint
const (
	PaddingLeft Padding = iota
	PaddingRight
	PaddingNone
)
type Hash struct {
	Bytes [HashLength]byte `msgp:"bytes"`
}
type Hashes []Hash
type HashBytes [HashLength]byte
func (h *Hash) Empty() bool {
	var hs Hash
	return bytes.Equal(h.Bytes[:], hs.Bytes[:])
}
func BytesToHash(b []byte) Hash {
	var h Hash
	h.MustSetBytes(b, PaddingLeft)
	return h
}
func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) }
func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
func HexStringToHash(s string) (Hash, error) {
	var h Hash
	err := h.SetBytes(FromHex(s))
	return h, err
}
func (h Hash) ToBytes() []byte { return h.Bytes[:] }
func (h Hash) Big() *big.Int { return new(big.Int).SetBytes(h.Bytes[:]) }
func (h Hash) Hex() string { return hexutil.Encode(h.Bytes[:]) }
func (h Hash) TerminalString() string {
	return fmt.Sprintf("%x…%x", h.Bytes[:3], h.Bytes[len(h.Bytes)-3:])
}
func (h Hash) String() string {
	return h.Hex()[:10]
}