// 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
//! This module contains the traits and related errors for hashers that take array references as //! arguments and return values as arrays. //!
usesuper::arrayref;
pubuse arrayref::HashError;
/// A trait for oneshot hashing, where the output is returned as an array. pubtrait Hash<const OUTPUT_LEN: usize> { /// Returns the digest for the given input byte slice, as an array, in immediate mode. fn hash(payload: &[u8]) -> Result<[u8; OUTPUT_LEN], HashError>;
}
/// A trait for incremental hashing, where the output is returned as an array. pubtrait DigestIncremental<const OUTPUT_LEN: usize>: super::DigestIncrementalBase { /// Returns the digest as an array. /// /// Note that the digest state can be continued to be used, to extend the digest. fn finish(state: &mutSelf::IncrementalState) -> [u8; OUTPUT_LEN];
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.