Skip to content

markrenaud/Base32Encoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base32Encoder

Carthage compatible

Base32Encoder is a pure Swift library that encodes Data to a Base32 String

About

Encodes data as per the [RFC 3548] specification for Base32 data encodings.

This library was written for a project that required encoding of small data packets and to learn bit bashing. This means the code is written for learning and has not been optimized for elegance or performance.

Installation

Carthage

Simply add the requirement to your Cartfile: github "markrenaud/Base32Encoder"

Manually

Copy Base32.swift to your project

Usage

If the Base32Encoder was installed as a library, you must import it (this can be skipped if it was manually added to your project). import import Base32Encoder

You can then encode data and (optionally pad as per RFC 3548 2.2 - Padding of encoded data

let data = "hi".data(using: .ascii)!
let base32 = Base32.encode(data: data) // = "NBUQ"
let base32padded = Base32.encode(data: data, padding: true) // = "NBUQ===="

Or you can use the Data extension

let base32 = data.base32String(padded: true) // = "NBUQ===="

Licence

This project is licensed under the MIT license. See the LICENCE file for more info.

About

A pure Swift library that encodes data to Base32 strings

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors