[][src]Crate passablewords

passablewords is a password validation library which checks a password against a million of the most common as well as it's ability to be cracked.

If you're asking why use passablewords over zxcvbn, it's because passablewords checks a password against 1,000,000 of the most common passwords. zxcvbn only checks 30,000. zxcvbn is a great tool, however, and passablewords uses it to check the entropy of a given password to make sure it's random enough on top of being unique enough. If you are ok with the top 30,000 most common passwords, then you should probably use zxcvbn. If you want a little extra, consider passablewords.

While you're free to use any of the public methods, using the check_password function is recommended since that checks for length, uniqueness, and entropy all within a single call.

It's also important to note that this is provided as-is and doesn't prevent an attacker from gaining access to, decrypting, or guessing your user's passwords. It just makes it a little harder.

Example

extern crate passablewords;

use passablewords::{check_password, PassablewordResult};

fn main() {
    match check_password(password) {
        Ok() => println!("That password is probably pretty good!")
        Err(err) => match(err) {
            PassablewordResult::TooShort => println!("Your password should be longer than 8 characters"),
            PassablewordResult::TooCommon => println!("Your should be more unique"),
            PassablewordResult::TooSimple => println!("Your should be more random"),
            PassablewordResult::InternalError => println!
        }
    }
}

Enums

PasswordError

The suite of possible errors returned from passablewords. These represent the three checks made for length, uniqueness, and entropy. If something goes wrong during the request, an InternalError error is returned.

Functions

check_entropy

Check a password to make sure random enough that it would take a lot of effort to crack/guess. This uses the awesome zxcvbn library behind the scenes.

check_length

Check a password to make sure it's at least 8 characters long. While this shouldn't be used as the only password check, it's a good baseline to start from.

check_password

Check a password's length, uniqueness, and entropy all in a single call. This is a convenience method and simply calls check_length, check_uniqueness, and check_entropy with the password supplied.

check_uniqueness

Check a password to make sure it's not within the top million most common passwords.

Type Definitions

PassablewordResult

The result type that will be returned from all public functions. It's simply a Result type that either returns Ok or a PasswordError.