2017 © Pedro Peláez
 

library base32hex

Base32Hex encoder/decoder

image

koksosk/base32hex

Base32Hex encoder/decoder

  • Wednesday, December 3, 2014
  • by koksosk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 14,416 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

About

Base32Hex is simple and easy to use class for base32hex encoding/decoding. Learn more about base32hex in this wiki section or in RFC 2938 standard document., (*1)

Base32Hex library

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Base32Hex class implements base32hex algorithm (as stated in RFC 2938) and implements these two main static methods: * Koksosk\Base32Hex::encode($string) * Koksosk\Base32Hex::decode($string), (*3)

Also these helper functions are included: * Koksosk\Base32Hex::stringToBinary($string) * Koksosk\Base32Hex::binaryToString($string), (*4)

See usage section below to see examples of usage. See the docs/ folder for generated API documentation., (*5)

Important

Please don't CONFUSE base32hex with base32 encoding, which looks is similar but it is different standard., (*6)

Requirements

Koksosk\Base32Hex requires PHP 5.3+, that's all., (*7)

Installation

The preferred method of installation is via Packagist, as this provides the PSR-0 autoloader functionality. The following composer.json will download and install the latest version of the Koksosk\Base32Hex library into your project:, (*8)

{
    "require": {
        "koksosk/base32hex": "*"
    }
}

Usage examples

Encode

Encoding string to base32hex., (*9)

// Encoding string 'Hello' to base32hex string
$s = \Koksosk\Base32Hex::encode('Hello');

var_dump($s);

This produces the following output:, (*10)

string(8) "91IMOR3F"

Decode

Decoding string from base32hex string., (*11)

// Decoding string from base32hex string '91IMOR3F'
$s = \Koksosk\Base32Hex::decode('91IMOR3F');

var_dump($s);

This produces the following output:, (*12)

string(5) "Hello"

String to binary

Convert string to binary string, (*13)

// Converting string "Hello" to binary string
$s = \Koksosk\Base32Hex::stringToBinary("Hello");

var_dump($s);

This produces the following output (length = 40bits = strlen("Hello") * 8 bits = 5 * 8 bits):, (*14)

string(40) "0100100001100101011011000110110001101111"

Binary to string

Convert binary string to string, (*15)

// Converting binary string "0100100001100101011011000110110001101111" to string
$s = \Koksosk\Base32Hex::binaryToString("0100100001100101011011000110110001101111");

var_dump($s);

This produces the following output:, (*16)

string(40) "Hello"

License

Copyright © 2014 Tomas Chvostek., (*17)

Licensed under the MIT License see here., (*18)

The Versions

03/12 2014

dev-master

9999999-dev https://github.com/koksosk/base32hex

Base32Hex encoder/decoder

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Tomas Chvostek

encoder decoder base32hex