encode($bytes, $offset, $length); } /** * Encodes the given bytes into a base-32 string, inserting dashes after every 6 characters of output. * * @static * @param array $bytes an array containing the bytes to encode * @param int $offset the start offset of the data within bytes * @param int $length the number of bytes to encode * @return string the base-32 string */ public static function encodeWithDashes(array $bytes, $offset = null, $length = null) { return self::getInstance()->encode($bytes, $offset, $length, '-', 6); } /** * Decodes the given base-32 string into a byte array. * * @static * @param string $string base-32 encoded string * @return array array containing the decoded bytes */ public static function decode($string) { return self::getInstance()->decode($string); } /** * Gets singleton instance of GTBaseX configured for base-32 encoding/decoding. * * @static * @return GTBaseX singleton instance of GTBaseX */ private static function getInstance() { if (self::$instance == null) { self::$instance = new GTBaseX("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", false, '='); } return self::$instance; } } ?>