56 public function crypt( $password ) {
57 $lastHash = $password;
58 foreach ( $this->config[
'types'] as $i =>
$type ) {
61 $passObj = $this->factory->newFromType(
$type );
65 if ( $this->params[$i] !==
'' ) {
66 $params = $this->params[
$i] . $passObj->getDelimiter();
68 if (
isset( $this->args[$i] ) && $this->args[$i] !==
'' ) {
69 $args = $this->args[
$i] . $passObj->getDelimiter();
74 $passObj = $this->factory->newFromCiphertext( $existingHash );
75 $passObj->crypt( $lastHash );
78 $this->params[
$i] = implode( $passObj->getDelimiter(), $passObj->params );
79 $this->args[
$i] = implode( $passObj->getDelimiter(), $passObj->args );
80 $lastHash = $passObj->hash;
98 $type = $passObj->config[
'type'];
99 if (
$type !== $this->config[
'types'][0] ) {
100 throw new MWException(
'Only a hash in the first layer can be finished.' );
104 $this->params[0] = implode( $passObj->getDelimiter(), $passObj->params );
105 $this->args[0] = implode( $passObj->getDelimiter(), $passObj->args );
106 $lastHash = $passObj->hash;
109 foreach ( $this->config[
'types'] as $i =>
$type ) {
116 $passObj = $this->factory->newFromType(
$type );
120 if ( $this->params[$i] !==
'' ) {
121 $params = $this->params[
$i] . $passObj->getDelimiter();
123 if (
isset( $this->args[$i] ) && $this->args[$i] !==
'' ) {
124 $args = $this->args[
$i] . $passObj->getDelimiter();
129 $passObj = $this->factory->newFromCiphertext( $existingHash );
130 $passObj->crypt( $lastHash );
133 $this->params[
$i] = implode( $passObj->getDelimiter(), $passObj->params );
134 $this->args[
$i] = implode( $passObj->getDelimiter(), $passObj->args );
135 $lastHash = $passObj->hash;