Expand description
This is a simple crate providing salt for commonly used hashing algorithms.
This crate will give you opportunity to generate tuple of type (hash, salt) for your needs.
§List of hashing algorithms
-
SHA:
- sha-1
- sha-224
- sha-256
- sha-384
- sha-512
- sha3-224
- sha3-256
- sha3-384
- sha3-512
-
MD:
- md2
- md4
- md5
- Bcrypt
-
Argon2:
- Argon2d
- Argon2i
- Argon2id
§Example
extern crate easy_salt;
use easy_salt::salty_sha::*;
fn main(){
let length: u64 = 8;
let hash = salty_sha256("hello", length);
println!("Hash: {:?}, Salt: {:?}", hash.0, hash.1);
let another_hash = salty_sha256("hello", length);
println!("Second Hash: {:?}, Second salt: {:?}", another_hash.0, another_hash.1);
assert_ne!(hash.0, another_hash.0);
}There is a plan to change logic so instead of tuple functions will return struct with fields hash and salt respectfully for better readability
Modules§
- salty_
md - This module contains MD* hashing algorithms. Althrough this hashing algorithms are vulnerable to different collision attacks and bruteforse, this functions might be helpful to save simple data, or as an example of using different algorithms.
- salty_
sha - This module provides salted SHA-* hashing algorithms
Functions§
- generate_
salt generate_saltfunction will generate random string of chars with given length