hash

Function hash 

Source
pub fn hash<D: Digest>(data: &[u8]) -> Vec<u8> 
Expand description

Hash data using the provided hasher type.

This is a generic function that works with any type implementing the Digest trait from the sha2 or sha3 crates.

§Type Parameters

  • D - A hasher type implementing Digest (e.g., Sha256, Sha3_512)

§Arguments

  • data - The data to hash

§Returns

The hash output as a byte vector

§Example

use rust_bottle::hash::hash;
use sha2::Sha256;

let data = b"Hello, world!";
let hash = hash::<Sha256>(data);