If I do the following in golang:
data := []byte{}
data = append(data, '1')
data = append(data, '2')
fmt.Printf("%d
", len(data))
fmt.Printf("%x
", fmt.Sprintf("%d", len(data)))
I get 2 and 32, respectively, instead of just 2 on both lines (obviously the array has only two elements).
If I do something similar-ish in solidity:
bytes memory encodedPack = abi.encodePacked(prefix, length, signedMessage)
The encodePacked
function also prepends the length with 3 in the final byte array.
According to the ASCII table, 3 represents "end of text". Is this what this 3 is for?