public static function ParagonIE_Sodium_Crypto::generichash_init in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Crypto.php \ParagonIE_Sodium_Crypto::generichash_init()
Initialize a hashing context for BLAKE2b.
@internal Do not use this directly. Use ParagonIE_Sodium_Compat.
Parameters
string $key:
int $outputLength:
Return value
string
Throws
RangeException
SodiumException
TypeError
1 call to ParagonIE_Sodium_Crypto::generichash_init()
- ParagonIE_Sodium_Compat::crypto_generichash_init in vendor/
paragonie/ sodium_compat/ src/ Compat.php - Initialize a BLAKE2b hashing context, for use in a streaming interface.
File
- vendor/
paragonie/ sodium_compat/ src/ Crypto.php, line 761
Class
- ParagonIE_Sodium_Crypto
- Class ParagonIE_Sodium_Crypto
Code
public static function generichash_init($key = '', $outputLength = 32) {
// This ensures that ParagonIE_Sodium_Core_BLAKE2b::$iv is initialized
ParagonIE_Sodium_Core_BLAKE2b::pseudoConstructor();
$k = null;
if (!empty($key)) {
$k = ParagonIE_Sodium_Core_BLAKE2b::stringToSplFixedArray($key);
if ($k
->count() > ParagonIE_Sodium_Core_BLAKE2b::KEYBYTES) {
throw new RangeException('Invalid key size');
}
}
/** @var SplFixedArray $ctx */
$ctx = ParagonIE_Sodium_Core_BLAKE2b::init($k, $outputLength);
return ParagonIE_Sodium_Core_BLAKE2b::contextToString($ctx);
}