Defuse\Crypto\KeyOrPassword::createFromPassword PHP Method

createFromPassword() public static method

Initializes an instance of KeyOrPassword from a password.
public static createFromPassword ( string $password ) : KeyOrPassword
$password string
return KeyOrPassword
    public static function createFromPassword($password)
    {
        return new KeyOrPassword(self::SECRET_TYPE_PASSWORD, $password);
    }

Usage Example

Beispiel #1
0
 /**
  * Decrypts a ciphertext to a string with a password, using a slow key
  * derivation function to make password cracking more expensive.
  *
  * @param string $ciphertext
  * @param string $password
  * @param bool   $raw_binary
  *
  * @throws Ex\EnvironmentIsBrokenException
  * @throws Ex\WrongKeyOrModifiedCiphertextException
  *
  * @return string
  */
 public static function decryptWithPassword($ciphertext, $password, $raw_binary = false)
 {
     return self::decryptInternal($ciphertext, KeyOrPassword::createFromPassword($password), $raw_binary);
 }
All Usage Examples Of Defuse\Crypto\KeyOrPassword::createFromPassword