// Copyright 2023 Cryspen Sarl // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 #![no_std] extern crate alloc; // NOTE: This Digest trait and the new `digest` trait APIs overlap to some extent. // See issue #1039 /// A Hash algorithm returning hashes of length `HASH_LEN`. pub trait Digest { /// Writes the digest for the given input byte slice, into `digest` in immediate mode. fn hash(digest: &mut [u8], payload: &[u8]); /// Add the `payload` to the digest. fn update(&mut self, payload: &[u8]); /// Writes the digest into `digest`. /// /// Note that the digest state can be continued to be used, to extend the /// digest. fn finish(&self, digest: &mut [u8; HASH_LEN]); /// Reset the digest state. fn reset(&mut self); } pub mod digest; pub mod kem;