Add Bytes32 serialization

master
HimbeerserverDE 2021-04-01 16:18:00 +02:00
parent f6ef7e2a32
commit 805aa6203d
No known key found for this signature in database
GPG Key ID: 1A651504791E6A8B
1 changed files with 12 additions and 0 deletions

View File

@ -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)
}