public static function ParagonIE_Sodium_Core32_BLAKE2b::finish in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Core32/BLAKE2b.php \ParagonIE_Sodium_Core32_BLAKE2b::finish()
@internal You should not use this directly from another application
@psalm-suppress MixedArgument @psalm-suppress MixedAssignment @psalm-suppress MixedArrayAccess @psalm-suppress MixedArrayAssignment @psalm-suppress MixedArrayOffset @psalm-suppress MixedMethodCall @psalm-suppress MixedOperand
Parameters
SplFixedArray $ctx:
SplFixedArray $out:
Return value
Throws
SodiumException
TypeError
2 calls to ParagonIE_Sodium_Core32_BLAKE2b::finish()
- ParagonIE_Sodium_Crypto32::generichash in vendor/
paragonie/ sodium_compat/ src/ Crypto32.php - Calculate a BLAKE2b hash.
- ParagonIE_Sodium_Crypto32::generichash_final in vendor/
paragonie/ sodium_compat/ src/ Crypto32.php - Finalize a BLAKE2b hashing context, returning the hash.
File
- vendor/
paragonie/ sodium_compat/ src/ Core32/ BLAKE2b.php, line 449
Class
- ParagonIE_Sodium_Core32_BLAKE2b
- Class ParagonIE_Sodium_Core_BLAKE2b
Code
public static function finish(SplFixedArray $ctx, SplFixedArray $out) {
self::pseudoConstructor();
if ($ctx[4] > 128) {
self::increment_counter($ctx, 128);
self::compress($ctx, $ctx[3]);
$ctx[4] -= 128;
if ($ctx[4] > 128) {
throw new SodiumException('Failed to assert that buflen <= 128 bytes');
}
for ($i = $ctx[4]; $i--;) {
$ctx[3][$i] = $ctx[3][$i + 128];
}
}
self::increment_counter($ctx, $ctx[4]);
$ctx[2][0] = self::new64(0xffffffff, 0xffffffff);
for ($i = 256 - $ctx[4]; $i--;) {
/** @var int $i */
$ctx[3][$i + $ctx[4]] = 0;
}
self::compress($ctx, $ctx[3]);
$i = (int) (($out
->getSize() - 1) / 8);
for (; $i >= 0; --$i) {
self::store64($out, $i << 3, $ctx[0][$i]);
}
return $out;
}