Base32
in package
implements
Transcoder
Tags
Table of Contents
Interfaces
Constants
- CROCKFORD = 3
- Douglas Crockford's vairant
- RFC2938 = 2
- "Extended hex" or "base32hex".
- RFC4648 = 1
- New RFC that obsoleted RFC3548, uses the same alphabet.
- PAD_CHAR = '='
Properties
Methods
- __construct() : mixed
- decode() : string
- encode() : string
- checkAlphabetType() : void
- generateAlphabet() : void
- getAlphabet() : array<int, string>
- pad() : string
- Pads $string on right side with $char to length divisible by $factor
- trim() : string
- Trims $char from right side of $string to length divisible by $factor
Constants
CROCKFORD
Douglas Crockford's vairant
public
int
CROCKFORD
= 3
0-9, A-Z without I, L, O, U
Tags
RFC2938
"Extended hex" or "base32hex".
public
int
RFC2938
= 2
0-9, A-V
RFC4648
New RFC that obsoleted RFC3548, uses the same alphabet.
public
int
RFC4648
= 1
A-Z, 2-7
PAD_CHAR
protected
string
PAD_CHAR
= '='
Properties
$alphabet
protected
array<int, array<int, string>>
$alphabet
= [self::RFC4648 => [], self::RFC2938 => [], self::CROCKFORD => []]
$type
protected
int
$type
= self::RFC4648
Methods
__construct()
public
__construct([int $type = self::RFC4648 ]) : mixed
Parameters
- $type : int = self::RFC4648
-
type of alphabet to use
decode()
public
decode(string $input) : string
Parameters
- $input : string
-
ascii string
Tags
Return values
string —binary string
encode()
public
encode(string $input) : string
Parameters
- $input : string
-
binary string
Return values
string —ascii string
checkAlphabetType()
protected
checkAlphabetType(int $type) : void
Parameters
- $type : int
Tags
generateAlphabet()
protected
generateAlphabet(int $type) : void
Parameters
- $type : int
getAlphabet()
protected
getAlphabet(int $type) : array<int, string>
Parameters
- $type : int
Return values
array<int, string>pad()
Pads $string on right side with $char to length divisible by $factor
protected
pad(string $string, int $factor, string $char) : string
Parameters
- $string : string
- $factor : int
- $char : string
Return values
stringtrim()
Trims $char from right side of $string to length divisible by $factor
protected
trim(string $string, int $factor) : string
Parameters
- $string : string
- $factor : int