[Plugin] Bcrypt
#38

Quote:
Originally Posted by xkirill
View Post
Downloaded v2.2.3 and updated the files.
it continues to say that there is a new version although it say above that it loaded version 2.2.3

Yes with password_verify($input, $hashed_password_from_db);
Did you remember to update bcrypt.inc and recompile the script? It seems to work fine for me

Quote:
Originally Posted by Nealll
View Post
It's impossible because even if you enter exactly the same caracrtere chain, bcrypt hash of another ways ...

Show me a code example ^^
This is the basic idea:
PHP Code:
<?php
$password 
'Hello World!';
$hash '$2y$12$D62QnfKU1bYMTode2W7UVeMb7maqY.Y7TCdWgQzj44HuOBK47Ej1Wl';
if(
password_verify($password$hash))
{
    
// Match
}
else
{
    
// No match
}
And something like this might resemble the actual use case:

PHP Code:
<?php
/**
 * Attempt to login using the given username and password. (simple example)
 * @param  string $username The username given by the user
 * @param  string $password The password given give the user
 * @return boolean            True if the login was successful, otherwise false
 */
public function login($username$password)
{
    
$success false;
    
$get_password_q "SELECT `id`, `password` FROM `users` WHERE `username` = ?";
    if(
$stmt $db->prepare($get_password_q))
    {
        
$stmt->bind_param("s"$username);
        
$stmt->execute();
        
$stmt->store_result();
        
$stmt->bind_result($id$hash);
        if(
$stmt->num_rows)
        {
            if(
password_verify($password$hash))
            {
                
// Correct password
                
$success true;
            }
            else
            {
                
// Wrong password
            
}
        }
        else
        {
            
// The user does not exist
        
}
        
$stmt->close();
    }
    return 
$success;
}
Reply


Messages In This Thread
Bcrypt (Password hash) - by Johnson_boy - 25.07.2013, 12:59
AW: Bcrypt - by Poket-Jony - 25.07.2013, 13:02
Re: Bcrypt - by Djole1337 - 25.07.2013, 13:17
Re: Bcrypt - by roschti - 25.07.2013, 13:52
AW: Bcrypt - by BigETI - 25.07.2013, 14:24
Re: Bcrypt - by Johnson_boy - 25.07.2013, 14:30
Re: Bcrypt - by Johnson_boy - 25.07.2013, 16:33
Re: Bcrypt - by Edvin - 25.07.2013, 17:54
Re: Bcrypt - by Maxips2 - 25.07.2013, 19:30
AW: Bcrypt - by BigETI - 25.07.2013, 20:37
Re: AW: Bcrypt - by Johnson_boy - 25.07.2013, 21:59
Re: Bcrypt - by Red_Dragon. - 26.07.2013, 03:09
Re: Bcrypt - by Dan.. - 26.07.2013, 07:12
Re: Bcrypt - by Niko_boy - 26.07.2013, 07:20
Re: Bcrypt - by Johnson_boy - 26.07.2013, 17:23
Re: Bcrypt - by Dan.. - 26.07.2013, 18:27
AW: Re: Bcrypt - by BigETI - 26.07.2013, 23:32
Re: Bcrypt - by Lorenc_ - 27.07.2013, 01:43
Re: Bcrypt - by Dan.. - 27.07.2013, 07:51
Re: Bcrypt - by Johnson_boy - 28.07.2013, 12:10
Re: Bcrypt - by Johnson_boy - 06.08.2013, 23:45
Respuesta: Bcrypt - by GutierrezDeVelasco - 25.01.2014, 21:40
Respuesta: Bcrypt - by GutierrezDeVelasco - 25.01.2014, 21:49
Re: Bcrypt - by Kaperstone - 20.07.2014, 22:10
Re: Bcrypt - by Johnson_boy - 21.07.2014, 08:11
Re: Bcrypt - by maddinat0r - 21.07.2014, 20:07
Re: Bcrypt - by Sonical - 28.07.2014, 20:44
Re: Bcrypt - by Kaperstone - 28.08.2014, 23:30
Re: Bcrypt - by Kaperstone - 18.11.2014, 02:50
Re: Bcrypt - by Johnson_boy - 20.11.2014, 22:03
Re: Bcrypt - by Kaperstone - 21.11.2014, 04:49
Re : Bcrypt - by Maxime_Creteur - 25.11.2014, 18:21
Re : Bcrypt - by Nealll - 28.11.2014, 18:48
Re: Re : Bcrypt - by Johnson_boy - 28.11.2014, 20:35
Re : Bcrypt - by Nealll - 29.11.2014, 06:40
Re: Bcrypt - by Kaperstone - 01.12.2014, 13:33
Re : Bcrypt - by Nealll - 01.12.2014, 15:49
Re: Bcrypt - by Johnson_boy - 01.12.2014, 23:49
Re: Bcrypt - by ProKillerpa - 01.12.2014, 23:51
Re : Bcrypt - by Nealll - 02.12.2014, 18:20

Forum Jump:


Users browsing this thread: 9 Guest(s)