Skip to content
Base32 Encoder/Decoder according to RFC 4648
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests Adding a unit test to confirm correct decode behavior for invalid string Jan 13, 2015
.gitattributes
.gitignore Ignore composer.lock file Sep 24, 2015
.scrutinizer.yml
.travis.yml set correct coveralls setting Dec 21, 2017
LICENSE
README.md dev dependencies modified May 13, 2016
build.xml Update build.xml Mar 21, 2013
composer.json
phpunit.xml.dist See description Aug 9, 2014

README.md

base32

Base32 Encoder/Decoder for PHP according to RFC 4648.

Build Status HHVM Status

Latest Stable Version Total Downloads Latest Unstable Version License

Do you like this? Flattr it:

Flattr base32

Usage

<?php

// Include class or user autoloader
use Base32\Base32;

$string = 'fooba';

$encoded = Base32::encode($string);
// $encoded contains now 'MZXW6YTB'

$decoded = Base32::decode($encoded);
// $decoded is again 'fooba'

About

Use

Initially created to work with the one time password project, yet it can stand alone just as well as Jordi Boggiano kindly pointed out. It's the only Base32 implementation I could make work that passes the test vectors (and contains unit tests).

Goal

Have a RFC compliant Base32 encoder and decoder. The implementation could be improved, but for now, it does the job and has unit tests. Ideally, the class can be enhanced while the unit tests keep passing.

Requirements

PHP 5.3 to 5.6 or 7.0+

If you want to run the tests, PHPUnit 5.0+ or up is required. Tests require PHP 5.6 or 7.0+.

Author

Christian Riesen chris.riesen@gmail.com http://christianriesen.com

Acknowledgements

Base32 is mostly based on the work of https://github.com/NTICompass/PHP-Base32

You can’t perform that action at this time.