ParagonIE_Sodium_Core32_BLAKE2b::increment_counter() public WP 1.0
{} It's a method of the class: ParagonIE_Sodium_Core32_BLAKE2b{}
No Hooks.
Return
null
. Null. Nothing.
Usage
$result = ParagonIE_Sodium_Core32_BLAKE2b::increment_counter( $ctx, $inc );
- $ctx(SplFixedarray) (required)
- -
- $inc(int) (required)
- -
Code of ParagonIE_Sodium_Core32_BLAKE2b::increment_counter() ParagonIE Sodium Core32 BLAKE2b::increment counter WP 5.7
public static function increment_counter($ctx, $inc)
{
if ($inc < 0) {
throw new SodiumException('Increasing by a negative number makes no sense.');
}
$t = self::to64($inc);
# S->t is $ctx[1] in our implementation
# S->t[0] = ( uint64_t )( t >> 0 );
$ctx[1][0] = self::add64($ctx[1][0], $t);
# S->t[1] += ( S->t[0] < inc );
if (!($ctx[1][0] instanceof ParagonIE_Sodium_Core32_Int64)) {
throw new TypeError('Not an int64');
}
/** @var ParagonIE_Sodium_Core32_Int64 $c*/
$c = $ctx[1][0];
if ($c->isLessThanInt($inc)) {
$ctx[1][1] = self::add64($ctx[1][1], self::to64(1));
}
}