research/py_ssz
Vitalik Buterin 53e70d9bdf Added py_ssz 2017-08-03 23:35:22 -04:00
..
py_ssz Added py_ssz 2017-08-03 23:35:22 -04:00
tests Added py_ssz 2017-08-03 23:35:22 -04:00
LICENSE Added py_ssz 2017-08-03 23:35:22 -04:00
README.md Added py_ssz 2017-08-03 23:35:22 -04:00
requirements.txt Added py_ssz 2017-08-03 23:35:22 -04:00
setup.py Added py_ssz 2017-08-03 23:35:22 -04:00

README.md

Simple serialization - an alternative to RLP that's much simpler.

The spec:

encode(string) = enc3b(len(string)) + string

Where enc3b(x) encodes x as three bytes, in big-endian format

encode(list) = enc3b(8388608 + sum(len([encode(x) for x in list]))) + \
               b''.join([encode(x) for x in list])

And that's it!

Examples:

cow -> \x00\x00\x03cow

[dog, horse] -> \x80\x00\x0e\x00\x00\x03dog\x00\x00\x05horse