Subversion Repositories oidplus

Rev

Rev 1439 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1439 Rev 1469
Line 226... Line 226...
226
                }
226
                }
227
 
227
 
228
                // Create a VTS MCF 1.0 hash based on the parameters of $hash and the password $password
228
                // Create a VTS MCF 1.0 hash based on the parameters of $hash and the password $password
229
                $calc_authkey_1 = vts_crypt_hash($algo, $password, $bin_salt, $ver, $mode, $iterations);
229
                $calc_authkey_1 = vts_crypt_hash($algo, $password, $bin_salt, $ver, $mode, $iterations);
230
 
230
 
231
                // We rewrite the MCF to make sure that they match (if params have the wrong order)
231
                // We re-encode the MCF to make sure that it can be compared with the VTS MCF 1.0 (correct sorting of params etc.)
232
                $calc_authkey_2 = crypt_modular_format_encode($id, $bin_salt, $bin_hash, $params);
232
                $calc_authkey_2 = crypt_modular_format_encode($id, $bin_salt, $bin_hash, $params);
233
 
233
 
234
                return hash_equals($calc_authkey_1, $calc_authkey_2);
234
                return hash_equals($calc_authkey_2, $calc_authkey_1);
235
        } else {
235
        } else {
236
                throw new Exception("Invalid VTS crypt version, expect 1.");
236
                throw new Exception("Invalid VTS crypt version, expect 1.");
237
        }
237
        }
238
}
238
}
239
 
239