public static function ParagonIE_Sodium_Crypto32::generichash_init_salt_personal in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Crypto32.php \ParagonIE_Sodium_Crypto32::generichash_init_salt_personal()
Initialize a hashing context for BLAKE2b.
@internal Do not use this directly. Use ParagonIE_Sodium_Compat.
Parameters
string $key:
int $outputLength:
string $salt:
string $personal:
Return value
string
Throws
RangeException
SodiumException
TypeError
1 call to ParagonIE_Sodium_Crypto32::generichash_init_salt_personal()
- ParagonIE_Sodium_Compat::crypto_generichash_init_salt_personal 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/ Crypto32.php, line 793
Class
- ParagonIE_Sodium_Crypto32
- Class ParagonIE_Sodium_Crypto
Code
public static function generichash_init_salt_personal($key = '', $outputLength = 32, $salt = '', $personal = '') {
// This ensures that ParagonIE_Sodium_Core32_BLAKE2b::$iv is initialized
ParagonIE_Sodium_Core32_BLAKE2b::pseudoConstructor();
$k = null;
if (!empty($key)) {
$k = ParagonIE_Sodium_Core32_BLAKE2b::stringToSplFixedArray($key);
if ($k
->count() > ParagonIE_Sodium_Core32_BLAKE2b::KEYBYTES) {
throw new RangeException('Invalid key size');
}
}
if (!empty($salt)) {
$s = ParagonIE_Sodium_Core32_BLAKE2b::stringToSplFixedArray($salt);
}
else {
$s = null;
}
if (!empty($salt)) {
$p = ParagonIE_Sodium_Core32_BLAKE2b::stringToSplFixedArray($personal);
}
else {
$p = null;
}
/** @var SplFixedArray $ctx */
$ctx = ParagonIE_Sodium_Core32_BLAKE2b::init($k, $outputLength, $s, $p);
return ParagonIE_Sodium_Core32_BLAKE2b::contextToString($ctx);
}