Base32 encoding and decoding class (RFC 4648, RFC 4648 extended hex, Crockford, z-base-32/Zooko).

Maintainers

👁 skleeschulte

Package info

github.com/skleeschulte/php-base32

pkg:composer/skleeschulte/base32

Statistics

Installs: 323 110

Dependents: 9

Suggesters: 0

Stars: 17

Open Issues: 1

0.0.2 2015-11-19 14:01 UTC

Requires

  • php: >=5.2.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 42b651598d42ca51c00a6e71d2587e64e6e80734

encodedecodebase32crockfordbcmathintegerrfc4686z-base-32zookobytestring

This package is not auto-updated.

Last update: 2026-06-21 03:55:26 UTC


README

PHP base32 encoding/decoding class (RFC 4648 standard and extended hex, Crockford, z-base-32/Zooko)

This class provides static methods to encode and decode data to/from the following encodings:

  • base32 (RFC 4648)
  • base32 extended hex (RFC 4648)
  • base32 Crockford
  • base32 Zooko (z-base-32)

For each encoding, there are methods for encoding/decoding byte-strings and for encoding/decoding non-negative integers of arbitrary length. To handle integers of arbitrary length, PHP's BC Math extension is used whenever PHP's internal integer type is not sufficient to store/process the data.

All exceptions thrown by this class will have an exception code corresponding to one of the codes defined in the class constants at the beginning of the class.

This class is designed to be fast and memory efficient and is fully documented using PHPDoc-blocks.

Installation

By composer

composer require skleeschulte/base32

manual:

wget https://codeload.github.com/skleeschulte/php-base32/zip/master

If you find any bugs or have suggestions for improvements, you are welcome to create a new issue at https://github.com/skleeschulte/php-base32/issues .