Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

File Size: 430 lines (14 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Base32:: (12 methods):
  decode()
  decodeUpper()
  encode()
  encodeUnpadded()
  encodeUpper()
  encodeUpperUnpadded()
  decode5Bits()
  decode5BitsUpper()
  encode5Bits()
  encode5BitsUpper()
  doDecode()
  doEncode()


Class: Base32  - X-Ref

Class Base32
[A-Z][2-7]

decode($src, $strictPadding = \false)   X-Ref
Decode a Base32-encoded string into raw binary

param: string $src
param: bool $strictPadding
return: string

decodeUpper($src, $strictPadding = \false)   X-Ref
Decode an uppercase Base32-encoded string into raw binary

param: string $src
param: bool $strictPadding
return: string

encode($src)   X-Ref
Encode into Base32 (RFC 4648)

param: string $src
return: string

encodeUnpadded($src)   X-Ref
Encode into Base32 (RFC 4648)

param: string $src
return: string

encodeUpper($src)   X-Ref
Encode into uppercase Base32 (RFC 4648)

param: string $src
return: string

encodeUpperUnpadded($src)   X-Ref
Encode into uppercase Base32 (RFC 4648)

param: string $src
return: string

decode5Bits($src)   X-Ref
Uses bitwise operators instead of table-lookups to turn 5-bit integers
into 8-bit integers.

param: int $src
return: int

decode5BitsUpper($src)   X-Ref
Uses bitwise operators instead of table-lookups to turn 5-bit integers
into 8-bit integers.

Uppercase variant.

param: int $src
return: int

encode5Bits($src)   X-Ref
Uses bitwise operators instead of table-lookups to turn 8-bit integers
into 5-bit integers.

param: int $src
return: string

encode5BitsUpper($src)   X-Ref
Uses bitwise operators instead of table-lookups to turn 8-bit integers
into 5-bit integers.

Uppercase variant.

param: int $src
return: string

doDecode($src, $upper = \false, $strictPadding = \true)   X-Ref
Base32 decoding

param: string $src
param: bool $upper
param: bool $strictPadding
return: string

doEncode($src, $upper = \false, $pad = \true)   X-Ref
Base32 Decoding

param: string $src
param: bool $upper
param: bool $pad
return: string