Crates.io | paranoid-hash |
lib.rs | paranoid-hash |
version | 0.5.0 |
source | src |
created_at | 2021-09-21 23:22:49.27668 |
updated_at | 2022-03-02 17:37:14.588193 |
description | A Hashing Library For Those Paranoid With Their Security |
homepage | |
repository | https://github.com/AtropineTears/Paranoid-Hash |
max_upload_size | |
id | 454651 |
size | 37,248 |
Paranoid-Hash is a rust crate for hashing files, strings, or bytes using a hash function provided by a Rust Library and the hash function provided by the Operating System.
The Library Hash Function that is used is Blake2b with any given digest size between 1 and 64.
The Operating System Hash Function can be either SHA1, SHA256, or SHA512.
A function to compare hash functions is included and attempts to be constant-time.
The hash function returns two strings that are encoded in hexadecimal. You can get the byte representation by using the function decode_from_hex()
.
use paranoid_hash::{ParanoidHash,OsAlgorithm};
fn main(){
// Hash Using Blake2b (32 bytes) and SHA256
let context = ParanoidHash::new(32usize,OsAlgorithm::SHA256);
}
use paranoid_hash::{ParanoidHash};
fn main(){
// Default Config
// [LIB] BLAKE2B_64
// [OS] SHA512
let context = ParanoidHash::default();
// Blake2B and SHA512 Hash Function Returns
let (blake_64,sha512) = context.read("example_file.txt").expect("Failed To Read File");
}
use paranoid_hash::{ParanoidHash};
fn main(){
let s: String = String::from("Hello. This string will be hashed");
let context = ParanoidHash::default();
let (blake2b,sha512) = context.read_str(s);
}
use paranoid_hash::{ParanoidHash};
fn main(){
let bytes: Vec<u8> = vec![78,32,48,64];
let context = ParanoidHash::default();
let (blake2b,sha512) = context.read_bytes(&bytes);
}
use paranoid_hash::{ParanoidHash};
fn main(){
let bytes: Vec<u8> = vec![78,32,48,64];
let context = ParanoidHash::default();
let (blake2b,sha512) = context.read_bytes(&bytes);
let hash_bytes = ParanoidHash::decode_from_hex(blake2b);
}
This is licensed under: