Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn multihash(wanthash: hashtypes, input: Vec<u8>) -> Result<Vec<u8>, String> {
- let ssl_hash: Option<Type> = match wanthash {
- hashtypes::sha1 => Some(Type::SHA1),
- hashtypes::sha2_256 => Some(Type::SHA256),
- hashtypes::sha2_512 => Some(Type::SHA512),
- _ => None,
- };
- match ssl_hash {
- Some(openssl_type) => Ok(hash(openssl_type, input.as_slice()).insert(0, wanthash.to_u8())), // Add the hashtype to the hash.
- None => Err("Sorry, we don't support that hash algorithm yet."),
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement