You are here

public static function ParagonIE_Sodium_Compat::crypto_pwhash in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_pwhash()

@psalm-suppress MixedArgument

Parameters

int $outlen:

string $passwd:

string $salt:

int $opslimit:

int $memlimit:

int|null $alg:

Return value

string

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Compat::crypto_pwhash()
php72compat.php in vendor/paragonie/sodium_compat/lib/php72compat.php
sodium_compat.php in vendor/paragonie/sodium_compat/lib/sodium_compat.php

File

vendor/paragonie/sodium_compat/src/Compat.php, line 1908

Class

ParagonIE_Sodium_Compat

Code

public static function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $alg = null) {
  ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1);
  ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2);
  ParagonIE_Sodium_Core_Util::declareScalarType($salt, 'string', 3);
  ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 4);
  ParagonIE_Sodium_Core_Util::declareScalarType($memlimit, 'int', 5);
  if (self::useNewSodiumAPI()) {
    if (!is_null($alg)) {
      ParagonIE_Sodium_Core_Util::declareScalarType($alg, 'int', 6);
      return sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $alg);
    }
    return sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit);
  }
  if (self::use_fallback('crypto_pwhash')) {
    return (string) call_user_func('\\Sodium\\crypto_pwhash', $outlen, $passwd, $salt, $opslimit, $memlimit);
  }

  // This is the best we can do.
  throw new SodiumException('This is not implemented, as it is not possible to implement Argon2i with acceptable performance in pure-PHP');
}