passwd 0.1.0
crypt(3)-compatible (UNIX passwd style) password hashing algorithms
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
passwd
A D library for UNIX-style (crypt(3)) password hashing.
Features
Supported hashing algorithms:
- SHA256-based crypt (algorithm "5")
- SHA512-based crypt (algorithm "6")
Usage example
import passwd;
import passwd.sha;
// Create salt for 6000-round SHA512 crypt
auto salt = SHA512Crypt.genSalt(6000);
// Create a hashed password
auto crypted = "hunter2".crypt(salt);
// Save hashed password to database or password file
// ...
// Test a password at login
auto password_guess = "hunter2";
assert (password_guess.canCryptTo(crypted));
Installation
It's currently not on the DUB registry because of issue #471. For now, you'll have to clone this repository and use dub add-local
. Alternatively, don't use dub
at all and just make sure source/
is in your (-I
) import path.
passwd
requires libbsd
for portable entropy generation. It's available on many systems. For example, you can install it on Debian with sudo apt-get install libbsd0
. If you're not using dub
, you'll need to add -L-lbsd
to your D compiler command line.
Documentation
The documentation isn't online yet for the same reason the package isn't on the DUB registry. You can build the docs yourself using dub build --build=docs
.
Contributing
New algorithms are welcome as long as they're well standardised for use in crypt(3)
implementations (and preferrably already in popular libc
s). Please provide thorough test suites, and add links to algorithm specifications.
This library is licensed under the Mozilla Public License version 2.0. Parts of the library might be relicensed for inclusion in D's standard libraries in future. Don't contribute patches if you're not okay with them being relicensed that way.
- 0.1.0 released 4 years ago
- sarneaud/passwd
- MPLv2
- Copyright © 2020, Simon Arneaud
- Authors:
- Dependencies:
- none
- System dependencies:
- libbsd (https://gitlab.freedesktop.org/libbsd/libbsd)
- Versions:
-
0.3.1 2021-Apr-17 0.3.0 2020-Jul-20 0.2.0 2020-Jul-14 0.1.0 2020-Jul-11 ~master 2021-Apr-17 - Download Stats:
-
-
0 downloads today
-
1 downloads this week
-
1 downloads this month
-
114 downloads total
-
- Score:
- 0.0
- Short URL:
- passwd.dub.pm