Latest 1.1.0
Homepage https://github.com/keefertaylor/Base58Swift
License MIT
Platforms ios 8.0, osx 10.10
Dependencies BigInt
Authors

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 depened 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.

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

I am happy to accept pull requests.

License

MIT

Latest podspec

{
    "name": "Base58Swift",
    "version": "1.1.0",
    "summary": "A pure swift implementation of base58 string encoding and decoding.",
    "description": "A pure swift implementation of base58 string encoding and decoding. Based off of https://github.com/jbenet/go-base58.",
    "homepage": "https://github.com/keefertaylor/Base58Swift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Keefer Taylor": "[email protected]"
    },
    "source": {
        "git": "https://github.com/keefertaylor/Base58Swift.git",
        "tag": "1.1.0"
    },
    "source_files": "Base58Swift/*.swift",
    "swift_version": "4.2",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "dependencies": {
        "BigInt": [
            "~> 3.1"
        ]
    },
    "testspecs": [
        {
            "name": "Tests",
            "test_type": "unit",
            "source_files": "Base58SwiftTests/*.swift"
        }
    ]
}

Pin It on Pinterest

Share This