https://github.com/andreid/rplplay
playign with rpl
https://github.com/andreid/rplplay
Last synced: over 1 year ago
JSON representation
playign with rpl
- Host: GitHub
- URL: https://github.com/andreid/rplplay
- Owner: AndreiD
- Created: 2019-03-21T19:59:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-21T20:05:41.000Z (over 7 years ago)
- Last Synced: 2025-01-31T07:14:44.784Z (over 1 year ago)
- Language: Go
- Size: 31.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RLP (Recursive Length Prefix) Playground
RLP is like a binary encoding of JSON, if JSON were restricted only to strings and arrays.
The RLP encoding function takes in an item. An item is defined as follows:
A string (ie. byte array) is an item
A list of items is an item
The string "dog" = [ 0x83, 'd', 'o', 'g' ]
The list [ "cat", "dog" ] = [ 0xc8, 0x83, 'c', 'a', 't', 0x83, 'd', 'o', 'g' ]
The empty string ('null') = [ 0x80 ]
The empty list = [ 0xc0 ]
The integer 0 = [ 0x80 ]
The encoded integer 0 ('\x00') = [ 0x00 ]
The encoded integer 15 ('\x0f') = [ 0x0f ]
The encoded integer 1024 ('\x04\x00') = [ 0x82, 0x04, 0x00 ]
The set theoretical representation of three, [ [], [[]], [ [], [[]] ] ] = [ 0xc7, 0xc0, 0xc1, 0xc0, 0xc3, 0xc0, 0xc1, 0xc0 ]
nothing to see here...yet