[][src]Module pwhash::md5_crypt

MD5 based hash.

This algorithm was developed for FreeBSD to replace the aging DES crypt. It was adopted in various Linux distributions and saw wide use. Presently, it's considered insecure and shouldn't be used for new passwords.

Example

use pwhash::md5_crypt;

assert_eq!(md5_crypt::hash_with(
    "$1$5pZSV9va$azfrPr6af3Fc7dLblQXVa0",
    "password").unwrap(),
    "$1$5pZSV9va$azfrPr6af3Fc7dLblQXVa0");

Parameters

  • Password length: unlimited.

  • Salt length: 0 to 8 characters. Default is 8.

  • Rounds: 1000 (fixed.)

Hash Format

The format of the hash is $1${salt}${checksum}, where:

  • {salt} is the salt string.

  • {checksum} is a 22-character Base64 encoding of the checksum.

Constants

MAX_SALT_LEN

Maximium salt length.

Functions

hashDeprecated

Hash a password with a randomly generated salt.

hash_withDeprecated

Hash a password with user-provided parameters.

verify

Verify that the hash corresponds to a password.