Commit 14c4f061 authored by obscuren's avatar obscuren

Convert a byte slice to address

parent 8820d4e5
......@@ -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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment