WordPress at Your Fingertips
function is not described

ParagonIE_Sodium_Compat::sub() public WP 1.0

Add two numbers (little-endian unsigned), storing the value in the first parameter.

This mutates $val.

{} It's a method of the class: ParagonIE_Sodium_Compat{}

No Hooks.

Return

null. Nothing.

Usage

$result = ParagonIE_Sodium_Compat::sub( $val, $addv );
$val(string) (required) (passed by reference — &)
-
$addv(string) (required)
-

Code of ParagonIE_Sodium_Compat::sub() WP 5.8.2

public static function sub(&$val, $addv)
{
    $val_len = ParagonIE_Sodium_Core_Util::strlen($val);
    $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv);
    if ($val_len !== $addv_len) {
        throw new SodiumException('values must have the same length');
    }
    $A = ParagonIE_Sodium_Core_Util::stringToIntArray($val);
    $B = ParagonIE_Sodium_Core_Util::stringToIntArray($addv);

    $c = 0;
    for ($i = 0; $i < $val_len; $i++) {
        $c = ($A[$i] - $B[$i] - $c);
        $A[$i] = ($c & 0xff);
        $c = ($c >> 8) & 1;
    }
    $val = ParagonIE_Sodium_Core_Util::intArrayToString($A);
}