pub struct Aes128(/* private fields */);Expand description
A key-scheduled Aes128 block cipher which can both encrypt and decrypt blocks.
Trait Implementations§
Source§impl AesBlockCipher for Aes128
impl AesBlockCipher for Aes128
Source§fn new_with_key(key: Self::Key) -> Self
fn new_with_key(key: Self::Key) -> Self
Schedule a new AES key.
§Scalar Equivalent
ⓘ
Self({
<aes::Aes128 as aes::cipher::KeyInit>::new_from_slice(key.as_ref())
.expect("AES size is statically correct")
})§AVX2 Intrinsics Used
_mm_aesimc_si128AESIMC xmm, xmm
_mm_aeskeygenassist_si128AESKEYGENASSIST xmm, xmm, imm8
§Neon Intrinsics Used
vaeseq_u8- This intrinsic compiles to the following instructions:
vaesimcq_u8- This intrinsic compiles to the following instructions:
Source§fn encrypt_many<const N: usize>(&self, blocks: [U8x16; N]) -> [U8x16; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
fn encrypt_many<const N: usize>(&self, blocks: [U8x16; N]) -> [U8x16; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
Encrypt blocks with AES-ECB
§Scalar Equivalent
ⓘ
let mut out = blocks;
for block in out.iter_mut() {
let block = aes::cipher::generic_array::GenericArray::from_mut_slice(
block.as_mut(),
);
aes::cipher::BlockEncrypt::encrypt_block((&self.0), block);
}
out§AVX2 Intrinsics Used
_mm_aesenc_si128AESENC xmm, xmm
_mm_aesenclast_si128AESENCLAST xmm, xmm
§Neon Intrinsics Used
vaeseq_u8- This intrinsic compiles to the following instructions:
vaesmcq_u8- This intrinsic compiles to the following instructions:
Source§const BLOCK_COUNT_HINT: usize = 4
const BLOCK_COUNT_HINT: usize = 4
Running
encrypt_many with this many blocks will typically result in good
performance.Source§impl AesBlockCipherDecrypt for Aes128
impl AesBlockCipherDecrypt for Aes128
Source§fn decrypt_many<const N: usize>(&self, blocks: [U8x16; N]) -> [U8x16; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
fn decrypt_many<const N: usize>(&self, blocks: [U8x16; N]) -> [U8x16; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
Decrypt blocks with AES-ECB
§Scalar Equivalent
ⓘ
let mut out = blocks;
for block in out.iter_mut() {
let block = aes::cipher::generic_array::GenericArray::from_mut_slice(
block.as_mut(),
);
aes::cipher::BlockDecrypt::decrypt_block((&self.0), block);
}
out§AVX2 Intrinsics Used
_mm_aesdec_si128AESDEC xmm, xmm
_mm_aesdeclast_si128AESDECLAST xmm, xmm
§Neon Intrinsics Used
vaesdq_u8- This intrinsic compiles to the following instructions:
vaesimcq_u8- This intrinsic compiles to the following instructions:
Auto Trait Implementations§
impl Freeze for Aes128
impl RefUnwindSafe for Aes128
impl Send for Aes128
impl Sync for Aes128
impl Unpin for Aes128
impl UnsafeUnpin for Aes128
impl UnwindSafe for Aes128
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more