rg3 / libbcrypt Goto Github PK
View Code? Open in Web Editor NEWbcrypt password hash C library
License: Creative Commons Zero v1.0 Universal
bcrypt password hash C library
License: Creative Commons Zero v1.0 Universal
This library is a simple wrapper providing a convenient reentrant interface for the bcrypt password hashing algorithm implementation as provided by Solar Designer at http://www.openwall.com/crypt/. An exact copy of that source code is included in the crypt_blowfish subdirectory. The provided C interface is inspired in the bcrypt Python module that can be found at http://code.google.com/p/py-bcrypt/, and consists of a function to generate salts with the characteristic work factor parameter, one to generate password hashes which can also used to verify passwords and one designed specifically to verify passwords and avoid timing attacks. Please check the header bcrypt.h. It contains the prototypes and lots of comments with examples. All this code is released to the public domain under the terms of CC0. See the COPYING file for the legal text.
E:\download\bcrypt_ndk-master\bcrypt_ndk-master\app\src\main\cpp\bcrypt/bcrypt.c:119: undefined reference to crypt_gensalt_rn' CMakeFiles/bcrypt.dir/src/main/cpp/bcrypt/bcrypt.c.o: In function
bcrypt_hashpw':
E:\download\bcrypt_ndk-master\bcrypt_ndk-master\app\src\main\cpp\bcrypt/bcrypt.c:127: undefined reference to `crypt_rn'
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Please recommend which branch do you recommend for production, any performance difference? thank you, master works as expected BTW.
To use bcrypt.a, it has a dependency on crypt_blowfish.a (so you need to build with both.)
I'm rather inexperienced with building static libs with ar, but couldn't we do (to build with only bcrypt.a)
bcrypt.a: bcrypt.o crypt_blowfish/crypt_blowfish.a
ar r bcrypt.a bcrypt.o crypt_blowfish/*.o
instead of
bcrypt.a: bcrypt.o crypt_blowfish/crypt_blowfish.a
ar r bcrypt.a bcrypt.o crypt_blowfish/crypt_blowfish.a
or is this type of coupling a bad idea?
Without any practical consequences on any systems I'm aware of, the current code wrongly returns 0 (success) from try_read when getting an EOF from /dev/urandom, which shouldn't happen but doesn't make the code any less weak. Also related to this, try_read doesn't really handle a requested read size of zero bytes properly.
Using gcc in netbeans on windows 10 to make the .a file,
I then link the .a file to a test project, and include the header file in it,
It compiles well, and executes but when calling
ret = bcrypt_gensalt(12, salt);
assert(ret == 0);
I get ret "Assertion failed: ret == 0, file main.c, line 20"
is this a bug or has it to do with the linking process
The line
if (try_read(fd, salt, RANDBYTES) != 0)
in bcrypt_gensalt actually puts the random bytes into the salt, not the input array. This means that the input array has whatever is left on the stack and so doesn't contain any randomness.
Is it possible to cross -compile bcrypt library for ARM?
I have tried compiling but in bcrypt/crypt_blowfish/Makefile i see we are including x86.o?
Getting the following during compile-time:
gcc bcrypt.c -o speed
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
/usr/bin/ld: /tmp/ccmyfr34.o: in function `bcrypt_gensalt':
bcrypt.c:(.text+0x230): undefined reference to `crypt_gensalt_rn'
/usr/bin/ld: /tmp/ccmyfr34.o: in function `bcrypt_hashpw':
bcrypt.c:(.text+0x28a): undefined reference to `crypt_rn'
collect2: error: ld returned 1 exit status```
The crypt_blowfish directory exists.
Running Ubuntu 'Disco' (19.04)
Any help?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.