pub trait Context: Send + Sync {
// Required methods
fn fork_finish(&self) -> Output;
fn fork(&self) -> Box<dyn Context>;
fn finish(self: Box<Self>) -> Output;
fn update(&mut self, data: &[u8]);
}展开描述
How 到 incrementally compute 一个 hash.
必需方法§
Sourcefn fork_finish(&self) -> Output
fn fork_finish(&self) -> Output
Finish the computation, returning the resulting output.
此 computation remains valid, 并 more data can be added later with
Context::update()。
Compare with Context::finish() which consumes the computation
并 prevents any further data being added. This can be more efficient
because it avoids 一个 hash context copy 到 apply Merkle-Damgård padding
(if required)。