go-waku/waku/v2/utils/hex.go

14 lines
302 B
Go
Raw Normal View History

2022-09-14 19:19:04 +00:00
package utils
import (
"encoding/hex"
"strings"
)
// DecodeHexString decodes input string into a hex string.
// Note that if the string is prefixed by 0x , it is trimmed
2022-09-14 19:19:04 +00:00
func DecodeHexString(input string) ([]byte, error) {
input = strings.TrimPrefix(input, "0x")
return hex.DecodeString(input)
}