[ 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: 947 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 28 functions

  abs()
  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

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

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

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

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

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

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

return: int
param: string $chr

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

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

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

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

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

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

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

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

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

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

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

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

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

return: string
param: int $int

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

return: int
param: string $string

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

return: int
param: string $string

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

return: int
param: string $string

memcmp($left, $right)   X-Ref

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

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.

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

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

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

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

return: string
param: int $int

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

return: string
param: int $int

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

return: string
param: int $int

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

return: string
param: int $int

strlen($str)   X-Ref
Safe string length

return: int
param: string $str

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

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

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

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

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

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

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

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

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

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

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

return: bool



Generated : Fri Apr 26 08:20:02 2024 Cross-referenced by PHPXref