Fluent Hash
fluent-hash is a wrapper on top of the ring cryptography library which provides a fluent interface for generating SHA-1 and SHA-2 hashes.
It provides convenience methods for generating hashes from the following types:
- &[u8]
- Vec<u8>
- &str
- std::fs::File
It also supports formatting hashes as bytes or hexadecimal.
Supported Hash Algorithms
The following SHA-1 and SHA2 algorithms are supported:
- SHA-1
- SHA-256
- SHA-384
- SHA-512
- SHA-512_256
Documentation
See the documentation at: https://docs.rs/fluent-hash/
Examples
Import the fluent_hash types.
use Sha1;
use Sha256;
use Sha384;
use Sha512;
use Sha512_256;
use Hashing;
use HashContext;
use Hash;
Hash a byte array.
let result: Hash = Sha256.hash;
Hash a byte vector.
let result: Hash = Sha256.hash_vec;
Hash a string.
let result: Hash = Sha256.hash_str;
Hash a file.
let result: Hash = Sha256.hash_file;
Format the hash.
let bytes: & = result.as_bytes;
let bytes_vec: = result.to_vec;
let hex: String = result.to_hex;
License
fluent-hash is distributed under the Apache License version 2.0.
Disclaimer
THE SOFTWARE IS PROVIDED "AS IS" THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.