ParagonIE_Sodium_Crypto32::generichash_final

Advertisement

Summery Summery

Finalize a BLAKE2b hashing context, returning the hash.

Syntax Syntax

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

Parameters Parameters

$ctx

(string) (Required)

$outlen

(int) (Optional)

Default value: 32

Return Return

(string)

Source Source

File: wp-includes/sodium_compat/src/Crypto32.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_Core32_BLAKE2b::stringToContext($ctx);

        /** @var SplFixedArray $out */
        $out = ParagonIE_Sodium_Core32_BLAKE2b::finish($context, $out);

        /** @var array<int, int> */
        $outArray = $out->toArray();
        return ParagonIE_Sodium_Core32_Util::intArrayToString($outArray);
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.