Coder Social home page Coder Social logo

base58swift's Introduction

Base58Swift

Build Status codecov Carthage Compatible Version License

Base58Swift is a Swift library that implements Base58 / Base58Check encodings for cryptocurrencies. It is based off of go-base-58 with some added functions.

Donations help me find time to work on Base58Swift. If you find the library useful, please consider donating to support ongoing develoment.

Currency Address
Tezos tz1SNXT8yZCwTss2YcoFi3qbXvTZiCojx833
Bitcoin 1CdPoF9cvw3YEiuRCHxdsGpvb5tSUYBBo
Bitcoin Cash qqpr9are9gzs5r0q7hy3gdehj3w074pyqsrhpdmxg6

Installation

CocoaPods

Base58Swift supports installation via CocoaPods. You can depend on Base58Swift by adding the following to your Podfile:

pod "Base58Swift"

Carthage

If you use Carthage to manage your dependencies, simply add Base58Swift to your Cartfile:

github "keefertaylor/Base58Swift"

If you use Carthage to build your dependencies, make sure you have added BigInt.framework and SipHash.framework, to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.

Swift Package Manager

Add the following to the dependencies section of your Package.swift file:

.package(url: "https://github.com/keefertaylor/Base58Swift.git", from: "2.1.0")

Usage

Base58Swift provides a static utility class, Base58, which provides encoding and decoding functions.

To encode / decode in Base58:

let bytes: [UInt8] = [255, 254, 253, 252]

let encodedString = Base58.encode(bytes)!
let decodedBytes = Base58.decode(encodedString)!

print(encodedString) // 7YXVWT
print(decodedBytes)  // [255, 254, 253, 252]

To encode / decode in Base58Check:

let bytes: [UInt8] = [255, 254, 253, 252]

let encodedString = Base58.base58CheckEncode(bytes)!
let decodedBytes = Base58.base58CheckDecode(encodedString)!

print(encodedString) // jpUz5f99p1R
print(decodedBytes)  // [255, 254, 253, 252]

Contributing

Pull requests are welcome.

To get set up:

$ brew install xcodegen # if you don't already have it
$ xcodegen generate # Generate an XCode project from Project.yml
$ open Base58Swift.xcodeproj

License

MIT

base58swift's People

Contributors

keefertaylor avatar dsemenovsky avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.