str0m-rust-crypto 0.3.0

Pure Rust crypto backend for str0m WebRTC
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! RustCrypto SHA-256 implementation.

use sha2::{Digest, Sha256};

use str0m_proto::crypto::Sha256Provider;

/// RustCrypto-based SHA-256 provider.
#[derive(Debug)]
pub struct RustCryptoSha256Provider;

impl Sha256Provider for RustCryptoSha256Provider {
    fn sha256(&self, data: &[u8]) -> [u8; 32] {
        let mut hasher = Sha256::new();
        hasher.update(data);
        hasher.finalize().into()
    }
}