Recursive Length Prefix encoding written in Swift

Overview

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.

You might also like...
Hassle-free JSON encoding and decoding in Swift
Hassle-free JSON encoding and decoding in Swift

#JSONCodable Hassle-free JSON encoding and decoding in Swift Installation Simply add the following to your Cartfile and run carthage update: github "m

Repository with base samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Includes steps for encoding and packaging your own test content.

Video Everything Repository with minimal samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Content and License All t

🧱 A JSON decoding/encoding library that handles optimistically or strictly.
🧱 A JSON decoding/encoding library that handles optimistically or strictly.

Do you need to handle the root cause of failure in decoding JSON? We often process the value as a default value if it could not be decoded from JSON.

Easy CBOR encoding and decoding for iOS, macOS, tvOS and watchOS.

CBORCoding CBORCoding is a lightweight framework containing a coder pair for encoding and decoding Codable conforming types to and from CBOR document

A `CodingKey` for any encoding or decoding container.

AnyCodingKey A CodingKey for any encoding or decoding container. Overview AnyCodingKey provides a wrapper for a String (and optionally an Int), and co

A full stack real time messenger clone. Frontend is written in swift, and the backend is written in javascript.

FullStack-Messenger-Project A full stack real time messenger clone. Frontend is written in swift, and the backend is written in javascript. The Fronte

JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift.

JSEN /ˈdʒeɪsən/ JAY-sən JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift. A JSON, as defined in the EC

Swift Express is a simple, yet unopinionated web application server written in Swift
Swift Express is a simple, yet unopinionated web application server written in Swift

Documentation h5 align="right"a href="http://demo.swiftexpress.io/"Live 🐧 server running Demo img src="https://cdn0.iconfinder.com/data/icons/

Swift Express is a simple, yet unopinionated web application server written in Swift
Swift Express is a simple, yet unopinionated web application server written in Swift

Documentation h5 align="right"a href="http://demo.swiftexpress.io/"Live 🐧 server running Demo img src="https://cdn0.iconfinder.com/data/icons/

Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project

Mutanus Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project. Inspired by Muter Usage mutanus -c path-to-co

Delightful code generation for OpenAPI specs for Swift written in Swift
Delightful code generation for OpenAPI specs for Swift written in Swift

Create API Delightful code generation for OpenAPI specs for Swift written in Swi

Swift-VIPER-Module - Xcode template for VIPER Architecture written in Swift 4
Swift-VIPER-Module - Xcode template for VIPER Architecture written in Swift 4

⚠️ Deprecated ⚠️ This library is deprecated. When you decide to use VIPER architecture in your project, it is very tired create new modules, because y

Swift-WordleSolver - Solve and analyze Wordle games. Command-line tool written in Swift

Swift-WordleSolver - Solve and analyze Wordle games. Command-line tool written in Swift

Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

Simplex-Swift - A basic implementation of the Simplex algorithm, written in Swift

Simplex-Swift - A basic implementation of the Simplex algorithm, written in Swift

AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.
AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

Gemini is rich scroll based animation framework for iOS, written in Swift.
Gemini is rich scroll based animation framework for iOS, written in Swift.

Overview What is the Gemini? Gemini is rich scroll based animation framework for iOS, written in Swift. You can easily use GeminiCollectionView, which

Pulse animation for iOS written with Swift.
Pulse animation for iOS written with Swift.

Pulsator Pulse animation for iOS written with Swift. Great For: Pulses of Bluetooth, BLE, beacons (iBeacon), etc. Map Annotations Installation CocoaPo

Google Directions API helper for iOS, written in Swift
Google Directions API helper for iOS, written in Swift

PXGoogleDirections Google Directions API SDK for iOS, entirely written in Swift. 🗺 Features Supports all features from the Google Directions API as o

Comments
  • Swift update

    Swift update

    This was to update the project to Swift 5.x. I removed redundant modifiers and deprecated method names in the project. It built and passed all the tests locally.

    opened by jessecanderson 3
  • Manual Installation Instructions Extensions missing

    Manual Installation Instructions Extensions missing

    Manual installation instructions specify that in order to install developers must

    Download and drop RLP.swift inside your project.

    but it's also required to import the UInt32+Extensions.swift file

    I also suggest to rename UInt32+Extensions.swift to UInt32+byteArrayLittleEndian.swift

    opened by bpolania 2
  • Is the rule of the RLP the same as that of Ethereum?

    Is the rule of the RLP the same as that of Ethereum?

    Our project want to use Ethereum RLP,But it cannot be used in iOS,So I want to write a code by reference to Ethereum.And then I found you. Anyway,thank you very much

    opened by daiyangyang945 1
  • Add decoding method

    Add decoding method

    The algorithm to decode an be found here on ethereum/wiki/RLP, they also have an implementation example in js.

    Suggestion for the function signature: func decode(_ data: Data) throws -> Data

    good first issue feature hacktoberfest 
    opened by alephao 0
Releases(v0.0.4)
  • v0.0.4(Oct 3, 2019)

  • v0.0.3(Feb 3, 2018)

    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
    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Feb 3, 2018)

  • v0.0.1(Jan 31, 2018)

    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"])
    Source code(tar.gz)
    Source code(zip)
Owner
bitfwd community
Crypto Community Ventures Network
bitfwd community
A Powerful , Extensible CSS Parser written in pure Swift.

A Powerful , Extensible CSS Parser written in pure Swift. Basic Usage From CSS: #View { "width" : 118; "height" : 120.5; "color1" : "#888888"; "co

null 273 Sep 9, 2022
Excel spreadsheet (XLSX) format parser written in pure Swift

CoreXLSX Excel spreadsheet (XLSX) format parser written in pure Swift CoreXLSX is a library focused on representing the low-level structure of the XML

null 684 Dec 21, 2022
Swift wrappers for the tree-sitter incremental parsing system

SwiftTreeSitter Swift wrappers for the tree-sitter incremental parsing system. Remember that tree-sitter has both runtime and per-language dependencie

Chime 153 Dec 8, 2022
WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser.

WKZombie WKZombie is an iOS/OSX web-browser without a graphical user interface. It was developed as an experiment in order to familiarize myself with

Mathias Köhnke 1.1k Dec 16, 2022
An UITextView in Swift. Support auto growing, placeholder and length limit.

GrowingTextView Requirements iOS 8.0 or above Installation CocoaPods GrowingTextView is available through CocoaPods. To install it, simply add the fol

Kenneth Tsang 941 Jan 5, 2023
An UITextView in Swift. Support auto growing, placeholder and length limit.

GrowingTextView Requirements iOS 8.0 or above Installation CocoaPods GrowingTextView is available through CocoaPods. To install it, simply add the fol

Kenneth Tsang 941 Jan 5, 2023
A customisable view for entering arbitrary length pins, codes or passwords in iOS. Supports iOS 12 one time codes.

CBPinEntryView CBPinEntryView is a view written in Swift to allow easy and slick entry of pins, codes or passwords. It allows backspacing, dismissal o

Chris Byatt 183 Dec 5, 2022
A Swift package for encoding and decoding Swift Symbol Graph files.

SymbolKit The specification and reference model for the Symbol Graph File Format. A Symbol Graph models a module, also known in various programming la

Apple 141 Dec 9, 2022
A Swift Encoder for encoding any Encodable value into an array of URLQueryItem.

URLQueryItemEncoder A Swift Encoder for encoding any Encodable value into an array of URLQueryItem. As part of the SE-0166, Swift has a foundation for

Pitiphong Phongpattranont 60 Aug 21, 2022
A protocol to serialize Swift structs and classes for encoding and decoding.

Serpent (previously known as Serializable) is a framework made for creating model objects or structs that can be easily serialized and deserialized fr

Nodes - iOS 287 Nov 11, 2022