Contents

heckj/base58swift

This is a fork of the [Base58Swift](https://github.com/keefertaylor/Base58Swift) project. The upstream project had a [longstanding issue](https://github.com/keefertaylor/Base58Swift/issues/23) with [a pull request pending to resolve it](https://github.com/keefertaylor/Base58Swift

Installation

Swift Package Manager

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

.package(url: "https://github.com/heckj/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]

License

MIT

Package Metadata

Repository: heckj/base58swift

Default branch: main

README: README.md