You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a basic Swift implementation of Recursive Length Prefix Encoding, a serialisation method for encoding arbitrarily structured binary data (byte arrays).
7
7
8
8
You can read more about it here:
9
9
*[Ethereum Wiki - RLP](https://github.com/ethereum/wiki/wiki/RLP)
10
10
*[Ethereum Yellowpaper](https://ethereum.github.io/yellowpaper/paper.pdf) (Appendix B)
11
11
12
-
# Getting Started
13
-
14
-
Encoding Strings and nested arrays of String
12
+
# Interface
15
13
16
14
```swift
17
-
// Encoding strings
18
-
try! RLP.encode("dog") // \u{83}dog
15
+
// Encoding Data
16
+
RLP.encode(_ data: Data) -> Data
17
+
18
+
// Encoding String
19
+
RLP.encode(_ string:String, with encoding:String.Encoding= .ascii) throws-> Data
20
+
21
+
// Encoding nested array of Data
22
+
RLP.encode(nestedArrayOfData array: [Any]) throws-> Data
0 commit comments