Module pwhash::unix_crypt
[−]
[src]
Seventh Edition Unix DES-based hash.
The original Unix password-hashing algorithm, extremely weak by today's standards. It should be used for backward compatibility only.
Example
use pwhash::unix_crypt; assert_eq!(unix_crypt::hash_with("xO", "password").unwrap(), "xOAFZqRz5RduI"); assert_eq!(unix_crypt::verify("password","xOAFZqRz5RduI"), true);
Parameters
-
Password length: effectively eight 7-bit characters; anything longer is ignored.
-
Salt length: 2 characters (12 bits).
-
Rounds: 25 (fixed).
Hash Format
The format of the hash is {salt}
{checksum}
, where:
-
{salt}
is a 2-character Base64 encoding of the salt. -
{checksum}
is a 11-character Base64 encoding of the checksum.
Constants
SALT_LEN |
Salt length. |
Functions
hash |
[ Deprecated ] Hash a password with a randomly generated salt. |
hash_with |
[ Deprecated ] Hash a password with a user-provided salt. |
verify |
Verify that the hash corresponds to a password. |