Expand description
§Paranoid-Hash
Paranoid-Hash is a cross-platform, memory-safe, simple to use library for hashing files securely with use of two hash functions.
The two hash functions are provided by a library in pure rust and the operating system hash function.
It supports the following hash functions
- [Library] BLAKE2B
- [OS] SHA1
- [OS] SHA256
- [OS] SHA512
For optimal security with a large security margin, it is recommended to use BLAKE2B with atleast a 48 byte digest and SHA256/SHA512.
§Default
The Default Configuration has a large security margin. It uses:
- BLAKE2B with a digest size of 64 bytes
- SHA512
§Filebuffer: Fast and Simple File Reading In Rust
Paranoid-Hash uses a simple file reading library called Filebuffer
that is faster than rust’s std::io.
If you wish to use the standard library instead, you can use read_using_fs()
§Handling The Return Type
After hashing, two variables are returned. The first one is the Blake2B hash digest. The second one is the chosen operating system digest.
§How To Use
This is an example using Blake2B (64 byte digest) and SHA256 (OS) to hash a file
use paranoid_hash::{ParanoidHash,OsAlgorithm};
fn main(){
let context = ParanoidHash::new(64,OsAlgorithm::SHA256);
let (blake2,sha256) = context.read("example_file.txt");
let bytes_b2 = ParanoidHash::as_bytes(&blake2);
let bytes_sha = ParanoidHash::as_bytes(&sha256);
}
Structs§
- Paranoid
Hash - SecureHash Hashing Constructor
Enums§
- File
Error - OsAlgorithm
- OS Hashing Function