commit 5357c7ea6c456b6ecb998814f870d2897fb0e763
parent 60bdf79cb0b0ad1e3c91cf19979081596df3b521
Author: Michael Savage <mikejsavage@gmail.com>
Date: Tue, 16 Dec 2014 11:18:44 +0000
Fix returning the opposite of what we should in bcrypt.verify
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -22,7 +22,7 @@ Usage
local log_rounds = 9
local digest = bcrypt.digest( "password", log_rounds )
- assert( bcrypt.verify( digest, "password" ) )
+ assert( bcrypt.verify( "password", digest ) )
Security concerns
diff --git a/src/main.c b/src/main.c
@@ -33,7 +33,7 @@ static int luabcrypt_verify( lua_State * const L ) {
const char * const password = luaL_checkstring( L, 1 );
const char * const goodhash = luaL_checkstring( L, 2 );
- const int ok = bcrypt_checkpass( password, goodhash );
+ const int ok = !bcrypt_checkpass( password, goodhash );
lua_pushboolean( L, ok );