akwizgran
2016-01-04 15:23:00 +00:00
parent 4dc3267505
commit 41490b8888

@@ -4,14 +4,14 @@ The first four bits of each object give the type. Depending on the type, the nex
* **0: Null** - Next four bits are zero.
* **1: Boolean** - Next four bits give the value, which is 0 or 1.
* **2: Integer** - Next four bits give the length, which is 0, 1, 2, 4 or 8. The value is an integer with the specified length.
* **3: Float** - Next four bits give the length, which is 4 or 8. The value is a floating point number with the specified length.
* **4: String** - Next four bits give the length-of-length, which is 0, 1, 2, 4 or 8. The length is an integer with the specified length-of-length. The value is a string with the specified length.
* **5: Raw** - Next four bits give the length-of-length, which is 0, 1, 2, 4 or 8. The length is an integer with the specified length-of-length. The value is raw data with the specified length.
* **2: Integer** - Next four bits give the length, which is 1, 2, 4 or 8. The value is an integer with the specified length.
* **3: Float** - Next four bits give the length, which is 8. The value is a floating point number with the specified length.
* **4: String** - Next four bits give the length-of-length, which is 1, 2, 4 or 8. The length is an integer with the specified length-of-length. The value is a string with the specified length.
* **5: Raw** - Next four bits give the length-of-length, which is 1, 2, 4 or 8. The length is an integer with the specified length-of-length. The value is raw data with the specified length.
* **6: List** - Next four bits are zero. The list contains zero or more elements followed by an end object. Elements may be of any type except end.
* **7: Dictionary** - Next four bits are zero. The dictionary contains zero or more key-value pairs followed by an end object. Keys are strings, values may be of any type except end. Duplicate keys are not allowed.
* **7: Dictionary** - Next four bits are zero. The dictionary contains zero or more key-value pairs followed by an end object. Keys are strings, values may be of any type except end.
* **8: End** - Next four bits are zero. Marks the end of a list or dictionary.
Integers and lengths are big-endian two's complement, floating point numbers are IEEE 754, and strings are UTF-8.
Integers and lengths must be represented using the minimum number of bytes. If data containing a dictionary is being hashed or signed, the dictionary keys should be sorted in lexicographic order.
If data is to be hashed or signed, integers and lengths should be represented using the minimum number of bytes, and dictionary keys should be unique and sorted in lexicographic order.