Hej, musze na nowo postawic serwis ktory obecnie stoi na Kohana
mam problem z haslami.
do generowania hasel Kohana wykorzystuje to:
function hash_password($password, $salt = FALSE)
{
if ($salt === FALSE)
{
// Create a salt seed, same length as the number of offsets in the pattern
$salt = substr($this->hash(uniqid(NULL, TRUE)), 0
, count($this->_config
['salt_pattern'])); }
// Password hash that the salt will be inserted into
$hash = $this->hash($salt.$password);
// Change salt to an array
$salt = str_split($salt, 1);
// Returned password
$password = '';
// Used to calculate the length of splits
$last_offset = 0;
foreach ($this->_config['salt_pattern'] as $offset)
{
// Split a new part of the hash off
$part = substr($hash, 0
, $offset - $last_offset);
// Cut the current part out of the hash
$hash = substr($hash, $offset - $last_offset);
// Add the part to the password, appending the salt character
// Set the last offset to the current offset
$last_offset = $offset;
}
// Return the password, with the remaining hash appended
return $password.$hash;
}
a plik
auth.php
(
'driver' => 'ORM',
'hash_method' => 'sha1',
'salt_pattern' => '1, 3, 5, 9, 14, 15, 20, 21, 28, 30',
'lifetime' => 1209600,
'session_key' => 'auth_user',
(
// 'admin' => '***',
),
);
a hasla w bazie są o 10 znaków dluzsze niz te wygenerowane metoda sha1 poniewaz jezeli dobrze rozumiem funkcja dodaje cos na koncu wykorzystuja salt?
jak moge zamienic sha1($haslo) tak zeby dzialalo z tym wyzej i generowalo hasla ktore pasuja do starej bazy?
dziekuje