package main import ( //"github.com/joaojeronimo/go-crc16" "bytes" "encoding/binary" //"strconv" "fmt" "net" "encoding/hex" //"strconv" ) func IntToBytes(data int64) []byte { bytebuf := bytes.NewBuffer([]byte{}) binary.Write(bytebuf, binary.BigEndian, data) return bytebuf.Bytes() } func ipToHexString(ip string) string { ipa := net.ParseIP(ip) p1 := fmt.Sprintf("%X", ipa[12]) if len(p1) == 1 { p1 = "0" + p1 } p2 := fmt.Sprintf("%X", ipa[13]) if len(p2) == 1 { p2 = "0" + p2 } p3 := fmt.Sprintf("%X", ipa[14]) if len(p3) == 1 { p3 = "0" + p3 } p4 := fmt.Sprintf("%X", ipa[15]) if len(p4) == 1 { p4 = "0" + p4 } s := fmt.Sprintf("%s%s%s%s", p1, p2, p3, p4) return s } func HexStringToBytes(s string) []byte { b, _ := hex.DecodeString(s) return b } func main () { /*str := "C0A8E3D4" bs := []byte{} for i:=0 ; i