libcrypt-rs

Crates.iolibcrypt-rs
lib.rslibcrypt-rs
version0.1.2
sourcesrc
created_at2022-09-24 18:01:29.218267
updated_at2022-09-24 23:54:43.664351
descriptionrust binding for POSIX crypt library (libcrypt)
homepagehttps://gitlab.com/Zapomnij/libcrypt-rs
repositoryhttps://gitlab.com/Zapomnij/libcrypt-rs.git
max_upload_size
id673141
size9,125
Jacek (zapomnij)

documentation

README

libcrypt-rs - rust binding for POSIX crypt library (libcrypt)

How to use it

Add to the dependencies section in your Cargo.toml:

libcrypt-rs = "0.1.2"

Documentation

cargo has cool feature for generating documentation:

  • Run
cargo doc
  • Open in web browser target/doc/libcrypt_rs/index.html

Example

use libcrypt_rs::{Crypt, Encryptions};

fn main() {
	let mut crypt_engine = Crypt::new();

	crypt_engine.gen_salt(Encryptions::Sha256).expect("Salt generating failed");
	crypt_engine.encrypt("1234".to_string()).expect("Encryption failed");

	println!("Encrypted data: {}", crypt_engine.encrypted);
}

Notices

  • Do not encrypt multiple data at the same time, otherwise can cause segmentation fault.
Commit count: 5

cargo fmt