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 } // 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 // Cut the current part out of the hash // 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
return array ( '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