#salt #hash #crypthography

easy_salt

Simple crate for generating hashed strings with salt, currently based on easy-hasher crate

4 releases (2 breaking)

new 0.3.0 Dec 21, 2024
0.2.0 Dec 19, 2024
0.1.1 Dec 17, 2024
0.1.0 Dec 14, 2024

#566 in Algorithms

Download history 270/week @ 2024-12-14

270 downloads per month

MIT license

29KB
224 lines

easy_salt 0.3.0

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.

All of the code was written on Android phone using Termux. :)

List of hashing algorithms

Unchecked algorithms will be added soon

  • 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.

Dependencies

~2MB
~24K SLoC