add an implementation for new_with_strategy() on sha512trunc256

this is needed to unbreak hosted mode. The strategy in hosted
mode is *always* to use software as there is no hardware hashing
engine.
This commit is contained in:
bunnie 2024-01-08 02:23:23 +08:00
parent 6e65cbda2e
commit 933666a67b

View file

@ -1,5 +1,6 @@
//! SHA-512
use crate::consts::{H384, H512, H512_TRUNC_224, H512_TRUNC_256, STATE_LEN};
use crate::FallbackStrategy;
use block_buffer::BlockBuffer;
use core::slice::from_ref;
use digest::consts::{U128, U28, U32, U48, U64};
@ -136,7 +137,13 @@ impl Reset for Sha384 {
pub struct Sha512Trunc256 {
engine: Engine512,
}
impl Sha512Trunc256 {
pub fn new_with_strategy(_strat: FallbackStrategy) -> Self {
Sha512Trunc256 {
engine: Engine512::new(&H512_TRUNC_256),
}
}
}
impl Default for Sha512Trunc256 {
fn default() -> Self {
Sha512Trunc256 {