Add Bytes32 serialization
parent
f6ef7e2a32
commit
805aa6203d
12
readwrite.go
12
readwrite.go
|
@ -73,3 +73,15 @@ func WriteBytes16(w io.Writer, v []byte) {
|
|||
WriteUint16(w, uint16(len(v)))
|
||||
w.Write(v)
|
||||
}
|
||||
|
||||
func ReadBytes32(r io.Reader) []byte {
|
||||
l := ReadUint32(r)
|
||||
b := make([]byte, l)
|
||||
r.Read(b)
|
||||
return b
|
||||
}
|
||||
|
||||
func WriteBytes32(w io.Writer, v []byte) {
|
||||
WriteUint32(w, uint32(len(v)))
|
||||
w.Write(v)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue