Convert a byte slice to address

pull/150/head
obscuren 11 years ago
parent 8820d4e5ac
commit 14c4f06100
  1. 10
      ethutil/bytes.go

@ -149,3 +149,13 @@ func LeftPadBytes(slice []byte, l int) []byte {
return padded
}
func Address(slice []byte) []byte {
if len(slice) < 20 {
slice = LeftPadBytes(slice, 20)
} else if len(slice) > 20 {
slice = slice[len(slice)-20:]
}
return slice
}

Loading…
Cancel
Save