Skip to content

Commit

Permalink
Add AlgorithmName implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jun 8, 2023
1 parent 6162aca commit 7fdb4e0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions belt-ctr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pub use cipher;

use belt_block::BeltBlock;
use cipher::{
consts::U16, crypto_common::InnerUser, generic_array::GenericArray, BlockDecrypt, BlockEncrypt,
BlockSizeUser, InnerIvInit, Iv, IvSizeUser, IvState, StreamCipherCore, StreamCipherCoreWrapper,
StreamCipherSeekCore, StreamClosure,
consts::U16, crypto_common::InnerUser, generic_array::GenericArray, AlgorithmName,
BlockDecrypt, BlockEncrypt, BlockSizeUser, InnerIvInit, Iv, IvSizeUser, IvState,
StreamCipherCore, StreamCipherCoreWrapper, StreamCipherSeekCore, StreamClosure,
};
use core::fmt;

Expand Down Expand Up @@ -112,6 +112,17 @@ where
}
}

impl<C> AlgorithmName for Encryptor<C>
where
C: BlockEncrypt + BlockDecrypt + BlockSizeUser<BlockSize = U16> + AlgorithmName,
{
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("BeltCtr<")?;
<C as AlgorithmName>::write_alg_name(f)?;
f.write_str(">")
}
}

impl<C: BlockEncrypt + BlockSizeUser<BlockSize = U16>> fmt::Debug for BeltCtrCore<C> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down

0 comments on commit 7fdb4e0

Please sign in to comment.