|
|
|
|
@ -6,13 +6,13 @@ type Str struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// struing to hex
|
|
|
|
|
func HexEncode(str string) string {
|
|
|
|
|
func (s *Str) HexEncode(str string) string {
|
|
|
|
|
byteStr := []byte(str)
|
|
|
|
|
return hex.EncodeToString(byteStr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// hex to string
|
|
|
|
|
func HexDecode(str string) (string, error) {
|
|
|
|
|
func (s *Str) HexDecode(str string) (string, error) {
|
|
|
|
|
hexStr, err := hex.DecodeString(str)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
|