You are here

public static function ParagonIE_Sodium_Crypto32::generichash_final in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Crypto32.php \ParagonIE_Sodium_Crypto32::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_Crypto32::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/Crypto32.php, line 730

Class

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