native_neural_network 0.3.1

Lib no_std Rust for native neural network (.rnn)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::crypto::{constant_time_eq, sha256_bytes, sha512_bytes};

pub fn verify_sha256(data: &[u8], expected: &[u8; 32]) -> bool {
    let mut out = [0u8; 32];
    sha256_bytes(data, &mut out);
    constant_time_eq(&out, expected)
}

pub fn verify_sha512(data: &[u8], expected: &[u8; 64]) -> bool {
    let mut out = [0u8; 64];
    sha512_bytes(data, &mut out);
    constant_time_eq(&out, expected)
}