Defuse\Crypto\Crypto::encryptWithPassword PHP Method

encryptWithPassword() public static method

Encrypts a string with a password, using a slow key derivation function to make password cracking more expensive.
public static encryptWithPassword ( string $plaintext, string $password, boolean $raw_binary = false ) : string
$plaintext string
$password string
$raw_binary boolean
return string
    public static function encryptWithPassword($plaintext, $password, $raw_binary = false)
    {
        return self::encryptInternal($plaintext, KeyOrPassword::createFromPassword($password), $raw_binary);
    }

Usage Example

コード例 #1
0
ファイル: Authentication.php プロジェクト: solverat/pimcore
 /**
  * @param $username
  * @param $passwordHash
  * @return string
  */
 public static function generateToken($username, $passwordHash)
 {
     $data = time() - 1 . '|' . $username;
     $token = Crypto::encryptWithPassword($data, $passwordHash);
     return $token;
 }
All Usage Examples Of Defuse\Crypto\Crypto::encryptWithPassword