Swiftpack.co - Package - bitfwdcommunity/RLPSwift

RLPSwift

Swift 5.3 Version Travis CI codecov.io

This is a basic Swift implementation of Recursive Length Prefix Encoding, a serialisation method for encoding arbitrarily structured binary data (byte arrays).

You can read more about it here:

Interface

// Encoding Data
RLP.encode(_ data: Data) -> Data

// Encoding String
RLP.encode(_ string: String, with encoding: String.Encoding = .ascii) throws -> Data

// Encoding nested array of Data
RLP.encode(nestedArrayOfData array: [Any]) throws -> Data

// Encoding nested array of String
RLP.encode(nestedArrayOfString array: [Any], encodeStringsWith encoding: String.Encoding = .ascii) throws -> Data

Installation

Cocoapods

RLPSwift is available through CocoaPods.

To install RLPSwift via cocoapods, add the following line to your Podfile:

pod 'RLPSwift'

Then run pod install.

Swift Package Manager

RLPSwift is available through Swift Package Manager.

Once you have your Swift package set up, adding RLPSwift as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
  .package(url: "https://github.com/bitfwdcommunity/RLPSwift.git", from: "0.0.4")
]

License

RLPSwift is released under an MIT license. See LICENSE for more information.

Github

link
Stars: 22

Dependencies

Used By

Total: 0

Releases

v0.0.4 - 2019-10-03 09:46:42

  • Update to Swift 5.0
  • Add support to Swift Package manager

- 2018-02-03 03:22:58

Changes

  • Now all encoding methods returns Data
  • Now the user can specify the character encoding scheme when encoding String and nested arrays of String
  • Enhanced RLP.Error localized descriptions

- 2018-02-03 03:17:38

Changes

  • Removed UIKit framework, using Foundation instead

- 2018-01-31 14:09:41

RLP Encoding for strings and nested string arrays

Features

  • Encode strings using RLP.encode("my string")
  • Encode nested string arrays using RLP.encode(["dog", ["cat", "lionr"], "wolf"])