extendhash
extendhash is a Rust library to compute hash extensions.
Supported hash algorithms:
- MD5
- SHA-1
Usage
use sha1;
let secret_data = "This is a secret!".as_bytes;
let hash = compute_hash;
let secret_data_length = secret_data.len;
// Now we try computing a hash extension,
// assuming that `secret_data` is not available.
// We only need `hash` and `secret_data_length`.
let appended_message = "Appended message.".as_bytes;
let combined_hash = extend_hash;
// Now we verify that `combined_hash` matches the
// concatenation (note the intermediate padding):
let mut combined_data = Vec:: new;
combined_data.extend_from_slice;
let intermediate_padding = padding_for_length;
combined_data.extend_from_slice;
combined_data.extend_from_slice;
assert_eq!;
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.