41 public function crypt( $password ) {
42 $secret = $this->config[
'secrets'][$this->params[
'secret']];
45 $underlyingPassword = $this->factory->newFromCiphertext( openssl_decrypt(
46 base64_decode( $this->hash ), $this->params[
'cipher'],
47 $secret, 0, base64_decode( $this->args[0] )
50 $underlyingPassword = $this->factory->newFromType( $this->config[
'underlying'] );
53 $underlyingPassword->crypt( $password );
56 $this->hash = openssl_encrypt(
57 $underlyingPassword->toString(), $this->params[
'cipher'], $secret, 0, $iv );
58 $this->args = [ base64_encode( $iv ) ];
68 if ( count( $this->args ) != 2 || $this->params == $this->
getDefaultParams() ) {
74 $underlyingHash = openssl_decrypt(
75 base64_decode( $this->args[1] ),
76 $this->params[
'cipher'],
77 $this->config[
'secrets'][$this->params[
'secret']],
79 base64_decode( $this->args[0] )
87 $this->hash = base64_encode( openssl_encrypt(
89 $this->params[
'cipher'],
90 $this->config[
'secrets'][$this->params[
'secret']],
94 $this->args = [ base64_encode( $iv ) ];