func DecodeUserInput(input string) ([]byte, error) {
	words := strings.Split(strings.TrimSpace(input), " ")
	var seed []byte
	switch {
	case len(words) == 1:
		var err error
		seed, err = hex.DecodeString(words[0])
		if err != nil {
			return nil, err
		}
	case len(words) > 1:
		decoded, err := pgpwordlist.DecodeMnemonics(words)
		if err != nil {
			return nil, err
		}
		if len(decoded) < 2 {  
			break
		}
		if checksumByte(decoded[:len(decoded)-1]) != decoded[len(decoded)-1] {
			return nil, errors.New("checksum mismatch")
		}
		seed = decoded[:len(decoded)-1]
	}
	if len(seed) < hdkeychain.MinSeedBytes || len(seed) > hdkeychain.MaxSeedBytes {
		return nil, hdkeychain.ErrInvalidSeedLen
	}
	return seed, nil
}
DecodeUserInput decodes a seed in either hexadecimal or mnemonic word list
encoding back into its binary form.
package walletseed
import (
	"bytes"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"strings"
	"github.com/HcashOrg/hcashutil/hdkeychain"
	"github.com/HcashOrg/hcashwallet/pgpwordlist"
)
func GenerateRandomSeed(size uint) ([]byte, error) {
	if size >= uint(^uint8(0)) {
		return nil, hdkeychain.ErrInvalidSeedLen
	}
	return hdkeychain.GenerateSeed(uint8(size))
}
func checksumByte(data []byte) byte {
	intermediateHash := sha256.Sum256(data)
	return sha256.Sum256(intermediateHash[:])[0]
}
func EncodeMnemonicSlice(seed []byte) []string {
	words := make([]string, len(seed)+1)  
	for i, b := range seed {
		words[i] = pgpwordlist.ByteToMnemonic(b, i)
	}
	checksum := checksumByte(seed)
	words[len(words)-1] = pgpwordlist.ByteToMnemonic(checksum, len(seed))
	return words
}
func EncodeMnemonic(seed []byte) string {
	var buf bytes.Buffer
	for i, b := range seed {
		if i != 0 {
			buf.WriteRune(' ')
		}
		buf.WriteString(pgpwordlist.ByteToMnemonic(b, i))
	}
	checksum := checksumByte(seed)
	buf.WriteRune(' ')
	buf.WriteString(pgpwordlist.ByteToMnemonic(checksum, len(seed)))
	return buf.String()
}