OSDN Git Service

new equity compiler (#1459)
[bytom/bytom.git] / common / bytes.go
index f8441e0..f30c899 100644 (file)
@@ -118,25 +118,9 @@ func Bytes2Hex(d []byte) string {
 
 func Hex2Bytes(str string) []byte {
        h, _ := hex.DecodeString(str)
-
        return h
 }
 
-func Hex2BytesFixed(str string, flen int) []byte {
-       h, _ := hex.DecodeString(str)
-       if len(h) == flen {
-               return h
-       } else {
-               if len(h) > flen {
-                       return h[len(h)-flen : len(h)]
-               } else {
-                       hh := make([]byte, flen)
-                       copy(hh[flen-len(h):flen], h[:])
-                       return hh
-               }
-       }
-}
-
 func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) {
        if len(str) > 1 && str[0:2] == "0x" && !strings.Contains(str, "\n") {
                ret = Hex2Bytes(str[2:])
@@ -225,21 +209,6 @@ func RightPadString(str string, l int) string {
        zeros := Bytes2Hex(make([]byte, (l-len(str))/2))
 
        return str + zeros
-
-}
-
-func ToAddress(slice []byte) (addr []byte) {
-       if len(slice) < 20 {
-               addr = LeftPadBytes(slice, 20)
-       } else if len(slice) > 20 {
-               addr = slice[len(slice)-20:]
-       } else {
-               addr = slice
-       }
-
-       addr = CopyBytes(addr)
-
-       return
 }
 
 func ByteSliceToInterface(slice [][]byte) (ret []interface{}) {