ParagonIE_Sodium_Compat::crypto_shorthash() public WP 1.0
Calculates a SipHash-2-4 hash of a message for a given key.
{} Это метод класса: ParagonIE_Sodium_Compat{}
Хуков нет.
Возвращает
Строку
. Hash
Использование
$result = ParagonIE_Sodium_Compat::crypto_shorthash( $message, $key );
- $message(строка) (обязательный)
- Input message
- $key(строка) (обязательный)
- SipHash-2-4 key
Код ParagonIE_Sodium_Compat::crypto_shorthash() ParagonIE Sodium Compat::crypto shorthash WP 5.7.1
public static function crypto_shorthash($message, $key)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 2);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_SHORTHASH_KEYBYTES) {
throw new SodiumException('Argument 2 must be CRYPTO_SHORTHASH_KEYBYTES long.');
}
if (self::useNewSodiumAPI()) {
return sodium_crypto_shorthash($message, $key);
}
if (self::use_fallback('crypto_shorthash')) {
return (string) call_user_func('\\Sodium\\crypto_shorthash', $message, $key);
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Core32_SipHash::sipHash24($message, $key);
}
return ParagonIE_Sodium_Core_SipHash::sipHash24($message, $key);
}