1 unstable release

0.1.0 Nov 29, 2018

#13 in #crypt

Apache-2.0 OR MIT

12KB
102 lines

Crypt3

Rust version of the unix crypt function.

License

Licensed under either of

at your option.


lib.rs:

This crate is a clone of the linux crypt command. It is a wrapper for the crypto algorithms used in crypt - Md5, blowfish, SHA256 and SHA512. The algorithm is chosen based on the first 3 characters of the secret. If it starts with $x$ where x is one of 1, 2, 3, 5 or 6.

Till this release (0.1), only MD5($1$), SHA256 ($5$) and SHA512 ($6$) are supported.

SECURITY ALERT:

The package is provided for the purposes of interoperability with protocols and systems that mandate the use of MD5. However, MD5 should be considered cryptographically broken and unsuitable for further use. Collision attacks against MD5 are both practical and trivial, and theoretical attacks against MD5 have been found. RFC6151 advises no new protocols to be designed with any MD5-based constructions, including HMAC-MD5.

INSTALLATION:

To add crypt to your package, add this to your Cargo.toml:

[dependencies]
crypt3 = "0.1"

EXAMPLES:

use crypt3::crypt;

let digest = crypt(b"abcdefghijklmnop", b"$1$");
assert_eq!(digest.unwrap(), [36, 49, 36, 36, 29, 100, 220, 226, 57, 196, 67, 123, 119, 54, 4, 29, 176, 137, 225, 185]);

Dependencies

~5.5MB
~197K SLoC