ParagonIE_Sodium_Compat::crypto_generichash_final() public WP 1.0
Get the final BLAKE2b hash output for a given context.
{} Это метод класса: ParagonIE_Sodium_Compat{}
Хуков нет.
Возвращает
Строку
. Final BLAKE2b hash.
Использование
$result = ParagonIE_Sodium_Compat::crypto_generichash_final( $ctx, $length );
- $ctx(строка) (обязательный)
- BLAKE2 hashing context. Generated by crypto_generichash_init().
- $length(число)
- Hash output size.
Код ParagonIE_Sodium_Compat::crypto_generichash_final() ParagonIE Sodium Compat::crypto generichash final WP 5.7
public static function crypto_generichash_final(&$ctx, $length = self::CRYPTO_GENERICHASH_BYTES)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1);
ParagonIE_Sodium_Core_Util::declareScalarType($length, 'int', 2);
if (self::useNewSodiumAPI()) {
return sodium_crypto_generichash_final($ctx, $length);
}
if (self::use_fallback('crypto_generichash_final')) {
$func = '\\Sodium\\crypto_generichash_final';
return (string) $func($ctx, $length);
}
if ($length < 1) {
try {
self::memzero($ctx);
} catch (SodiumException $ex) {
unset($ctx);
}
return '';
}
if (PHP_INT_SIZE === 4) {
$result = ParagonIE_Sodium_Crypto32::generichash_final($ctx, $length);
} else {
$result = ParagonIE_Sodium_Crypto::generichash_final($ctx, $length);
}
try {
self::memzero($ctx);
} catch (SodiumException $ex) {
unset($ctx);
}
return $result;
}