public static function ParagonIE_Sodium_Crypto::generichash_final in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Crypto.php \ParagonIE_Sodium_Crypto::generichash_final()
Finalize a BLAKE2b hashing context, returning the hash.
@internal Do not use this directly. Use ParagonIE_Sodium_Compat.
Parameters
string $ctx:
int $outlen:
Return value
string
Throws
SodiumException
TypeError
1 call to ParagonIE_Sodium_Crypto::generichash_final()
- ParagonIE_Sodium_Compat::crypto_generichash_final in vendor/
paragonie/ sodium_compat/ src/ Compat.php - Get the final BLAKE2b hash output for a given context.
File
- vendor/
paragonie/ sodium_compat/ src/ Crypto.php, line 731
Class
- ParagonIE_Sodium_Crypto
- Class ParagonIE_Sodium_Crypto
Code
public static function generichash_final($ctx, $outlen = 32) {
if (!is_string($ctx)) {
throw new TypeError('Context must be a string');
}
$out = new SplFixedArray($outlen);
/** @var SplFixedArray $context */
$context = ParagonIE_Sodium_Core_BLAKE2b::stringToContext($ctx);
/** @var SplFixedArray $out */
$out = ParagonIE_Sodium_Core_BLAKE2b::finish($context, $out);
/** @var array<int, int> */
$outArray = $out
->toArray();
return ParagonIE_Sodium_Core_Util::intArrayToString($outArray);
}