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.

(no description)

File Size: 300 lines (9 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ByteBuffer:: (26 methods):
  __construct()
  fromBase64Url()
  fromHex()
  randomBuffer()
  getBytes()
  getByteVal()
  getJson()
  getLength()
  getUint16Val()
  getUint32Val()
  getUint64Val()
  getHalfFloatVal()
  getFloatVal()
  getDoubleVal()
  getBinaryString()
  equals()
  getHex()
  isEmpty()
  jsonSerialize()
  serialize()
  unserialize()
  __serialize()
  __toString()
  __unserialize()
  _base64url_decode()
  _base64url_encode()


Class: ByteBuffer  - X-Ref

Modified version of https://github.com/madwizard-thomas/webauthn-server/blob/master/src/Format/ByteBuffer.php
Copyright © 2018 Thomas Bleeker - MIT licensed
Modified by Lukas Buchs
Thanks Thomas for your work!

__construct($binaryData)   X-Ref


fromBase64Url($base64url)   X-Ref
create a ByteBuffer from a base64 url encoded string

param: string $base64url
return: ByteBuffer

fromHex($hex)   X-Ref
create a ByteBuffer from a base64 url encoded string

param: string $hex
return: ByteBuffer

randomBuffer($length)   X-Ref
create a random ByteBuffer

param: string $length
return: ByteBuffer

getBytes($offset, $length)   X-Ref
No description

getByteVal($offset)   X-Ref
No description

getJson($jsonFlags=0)   X-Ref
No description

getLength()   X-Ref
No description

getUint16Val($offset)   X-Ref
No description

getUint32Val($offset)   X-Ref
No description

getUint64Val($offset)   X-Ref
No description

getHalfFloatVal($offset)   X-Ref
No description

getFloatVal($offset)   X-Ref
No description

getDoubleVal($offset)   X-Ref
No description

getBinaryString()   X-Ref

return: string

equals($buffer)   X-Ref

param: string|ByteBuffer $buffer
return: bool

getHex()   X-Ref

return: string

isEmpty()   X-Ref

return: bool

jsonSerialize()   X-Ref
jsonSerialize interface
return binary data in RFC 1342-Like serialized string

return: string

serialize()   X-Ref
Serializable-Interface

return: string

unserialize($serialized)   X-Ref
Serializable-Interface

param: string $serialized

__serialize()   X-Ref
(PHP 8 deprecates Serializable-Interface)

return: array

__toString()   X-Ref
object to string

return: string

__unserialize($data)   X-Ref
(PHP 8 deprecates Serializable-Interface)

param: array $data
return: void

_base64url_decode($data)   X-Ref
base64 url decoding

param: string $data
return: string

_base64url_encode($data)   X-Ref
base64 url encoding

param: string $data
return: string