[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/sodium_compat/src/Core/ -> Util.php (summary)

Class ParagonIE_Sodium_Core_Util

File Size: 971 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 29 functions

  abs()
  andStrings()
  bin2hex()
  bin2hexUpper()
  chrToInt()
  compare()
  declareScalarType()
  hashEquals()
  hash_update()
  hex2bin()
  intArrayToString()
  intToChr()
  load_3()
  load_4()
  load64_le()
  memcmp()
  mul()
  numericTo64BitInteger()
  store_3()
  store32_le()
  store_4()
  store64_le()
  strlen()
  stringToIntArray()
  substr()
  verify_16()
  verify_32()
  xorStrings()
  isMbStringOverride()

Functions
Functions that are not part of a class:

abs($integer, $size = 0)   X-Ref

param: int $integer
param: int $size (16, 32, 64)
return: int

andStrings($a, $b)   X-Ref

param: string $a
param: string $b
return: string

bin2hex($binaryString)   X-Ref
Convert a binary string into a hexadecimal string without cache-timing
leaks

param: string $binaryString (raw binary)
return: string

bin2hexUpper($bin_string)   X-Ref
Convert a binary string into a hexadecimal string without cache-timing
leaks, returning uppercase letters (as per RFC 4648)

param: string $bin_string (raw binary)
return: string

chrToInt($chr)   X-Ref
Cache-timing-safe variant of ord()

param: string $chr
return: int

compare($left, $right, $len = null)   X-Ref
Compares two strings.

param: string $left
param: string $right
param: int $len
return: int

declareScalarType(&$mixedVar = null, $type = 'void', $argumentIndex = 0)   X-Ref
If a variable does not match a given type, throw a TypeError.

param: mixed $mixedVar
param: string $type
param: int $argumentIndex
return: void

hashEquals($left, $right)   X-Ref
Evaluate whether or not two strings are equal (in constant-time)

param: string $left
param: string $right
return: bool

hash_update(&$hs, $data)   X-Ref
Catch hash_update() failures and throw instead of silently proceeding

param: HashContext|resource &$hs
param: string $data
return: void

hex2bin($hexString, $ignore = '', $strictPadding = false)   X-Ref
Convert a hexadecimal string into a binary string without cache-timing
leaks

param: string $hexString
param: string $ignore
param: bool $strictPadding
return: string (raw binary)

intArrayToString(array $ints)   X-Ref
Turn an array of integers into a string

param: array<int, int> $ints
return: string

intToChr($int)   X-Ref
Cache-timing-safe variant of ord()

param: int $int
return: string

load_3($string)   X-Ref
Load a 3 character substring into an integer

param: string $string
return: int

load_4($string)   X-Ref
Load a 4 character substring into an integer

param: string $string
return: int

load64_le($string)   X-Ref
Load a 8 character substring into an integer

param: string $string
return: int

memcmp($left, $right)   X-Ref

param: string $left
param: string $right
return: int

mul($a, $b, $size = 0)   X-Ref
Multiply two integers in constant-time

Micro-architecture timing side-channels caused by how your CPU
implements multiplication are best prevented by never using the
multiplication operators and ensuring that our code always takes
the same number of operations to complete, regardless of the values
of $a and $b.

param: int $a
param: int $b
param: int $size Limits the number of operations (useful for small,
return: int

numericTo64BitInteger($num)   X-Ref
Convert any arbitrary numbers into two 32-bit integers that represent
a 64-bit integer.

param: int|float $num
return: array<int, int>

store_3($int)   X-Ref
Store a 24-bit integer into a string, treating it as big-endian.

param: int $int
return: string

store32_le($int)   X-Ref
Store a 32-bit integer into a string, treating it as little-endian.

param: int $int
return: string

store_4($int)   X-Ref
Store a 32-bit integer into a string, treating it as big-endian.

param: int $int
return: string

store64_le($int)   X-Ref
Stores a 64-bit integer as an string, treating it as little-endian.

param: int $int
return: string

strlen($str)   X-Ref
Safe string length

param: string $str
return: int

stringToIntArray($string)   X-Ref
Turn a string into an array of integers

param: string $string
return: array<int, int>

substr($str, $start = 0, $length = null)   X-Ref
Safe substring

param: string $str
param: int $start
param: int $length
return: string

verify_16($a, $b)   X-Ref
Compare a 16-character byte string in constant time.

param: string $a
param: string $b
return: bool

verify_32($a, $b)   X-Ref
Compare a 32-character byte string in constant time.

param: string $a
param: string $b
return: bool

xorStrings($a, $b)   X-Ref
Calculate $a ^ $b for two strings.

param: string $a
param: string $b
return: string

isMbStringOverride()   X-Ref
Returns whether or not mbstring.func_overload is in effect.

return: bool



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref