# HashAlgorithm in tlsn::hash - Rust
A hashing algorithm.

Skip to main content

## HashAlgorithm

# Trait HashAlgorithm

Source

    pub trait HashAlgorithm {
        // Required methods
        fn id(&self) -> HashAlgId;
        fn hash(&self, data: &[u8]) -> Hash;
        fn hash_prefixed(&self, prefix: &[u8], data: &[u8]) -> Hash;
    }

Expand description

A hashing algorithm.

## Required Methods§

Source

#### fn id(&self) -> HashAlgId

Returns the hash algorithm identifier.

Source

#### fn hash(&self, data: &[u8]) -> Hash

Computes the hash of the provided data.

Source

#### fn hash_prefixed(&self, prefix: &[u8], data: &[u8]) -> Hash

Computes the hash of the provided data with a prefix.

## Implementors§

Source §

### impl HashAlgorithm for Blake3

Source §

### impl HashAlgorithm for Keccak256

Source §

### impl HashAlgorithm for Sha256