ParagonIE_Sodium_Crypto::generichash_final

Advertisement

Summery Summery

Finalize a BLAKE2b hashing context, returning the hash.

Syntax Syntax

ParagonIE_Sodium_Crypto::generichash_final( string $ctx, int $outlen = 32 )

Parameters Parameters

$ctx

(Required)

$outlen

(Optional)

Default value: 32

Return Return

(string)

Source Source

File: wp-includes/sodium_compat/src/Crypto.php

    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);
    }

Advertisement

Advertisement

Leave a Reply