rscrypt is a simple, fast, and secure encryption tool written in Rust.
Add rscrypt to your Cargo.toml:
toml
[dependencies]
rscrypt = "*"
or install via cargo
bash
cargo add rscrypt
rscrypt contains simple functions for encrypting and decrypting data.
gen_salt
: Generates a random salt.get_salt
: Extracts the salt from the hashed string.get_cost
: Extracts the cost from the salt.hash
: Hashes a string with a salt.encode
: Encodes a string to base64.decode
: Decodes a base64 string.compare
: compare a string to a hashed string.```rust use rscrypt::{gen_salt, hash, compare};
fn main() { let salt = gensalt(10); let hash = hash(&salt, "password"); let iscorrect = compare("password", &hash); println!("{}", is_correct); } ```