public static function ParagonIE_Sodium_Core_BLAKE2b::update in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Core/BLAKE2b.php \ParagonIE_Sodium_Core_BLAKE2b::update()
@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 MixedOperand
Parameters
SplFixedArray $ctx:
SplFixedArray $p:
int $plen:
Return value
void
Throws
SodiumException
TypeError
3 calls to ParagonIE_Sodium_Core_BLAKE2b::update()
- ParagonIE_Sodium_Core_BLAKE2b::init in vendor/
paragonie/ sodium_compat/ src/ Core/ BLAKE2b.php - @internal You should not use this directly from another application
- ParagonIE_Sodium_Crypto::generichash in vendor/
paragonie/ sodium_compat/ src/ Crypto.php - Calculate a BLAKE2b hash.
- ParagonIE_Sodium_Crypto::generichash_update in vendor/
paragonie/ sodium_compat/ src/ Crypto.php - Update a hashing context for BLAKE2b with $message
File
- vendor/
paragonie/ sodium_compat/ src/ Core/ BLAKE2b.php, line 455
Class
- ParagonIE_Sodium_Core_BLAKE2b
- Class ParagonIE_Sodium_Core_BLAKE2b
Code
public static function update(SplFixedArray $ctx, SplFixedArray $p, $plen) {
self::pseudoConstructor();
$offset = 0;
while ($plen > 0) {
$left = $ctx[4];
$fill = 256 - $left;
if ($plen > $fill) {
# memcpy( S->buf + left, in, fill ); /* Fill buffer */
for ($i = $fill; $i--;) {
$ctx[3][$i + $left] = $p[$i + $offset];
}
# S->buflen += fill;
$ctx[4] += $fill;
# blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
self::increment_counter($ctx, 128);
# blake2b_compress( S, S->buf ); /* Compress */
self::compress($ctx, $ctx[3]);
# memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); /* Shift buffer left */
for ($i = 128; $i--;) {
$ctx[3][$i] = $ctx[3][$i + 128];
}
# S->buflen -= BLAKE2B_BLOCKBYTES;
$ctx[4] -= 128;
# in += fill;
$offset += $fill;
# inlen -= fill;
$plen -= $fill;
}
else {
for ($i = $plen; $i--;) {
$ctx[3][$i + $left] = $p[$i + $offset];
}
$ctx[4] += $plen;
$offset += $plen;
$plen -= $plen;
}
}
}