fix: implement Write trait for digest engines
This commit is contained in:
@@ -37,6 +37,25 @@ pub trait DigestEngine {
|
||||
fn update(&mut self, data: &[u8]);
|
||||
}
|
||||
|
||||
// Dummy writer that implements Write for the none digest engine
|
||||
struct DummyWriter;
|
||||
|
||||
impl DummyWriter {
|
||||
fn new() -> Self {
|
||||
DummyWriter
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for DummyWriter {
|
||||
fn write(&mut self, _buf: &[u8]) -> io::Result<usize> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref DIGEST_PROGRAMS: EnumMap<DigestType, Option<DigestEngineProgram>> = enum_map! {
|
||||
DigestType::Sha256 => None,
|
||||
|
||||
Reference in New Issue
Block a user