ChaCha20CipherAlgorithm

Struct ChaCha20CipherAlgorithm 

Source
pub struct ChaCha20CipherAlgorithm { /* private fields */ }
Expand description

ChaCha20密码算法

Trait Implementations§

Source§

impl CipherAlgorithmBaseTrait for ChaCha20CipherAlgorithm

Source§

const IV_LENGTH: usize = 12usize

Source§

const KEY_LENGTH: usize = 32usize

Source§

const CIPHER_ALGORITHM_TYPE: CipherAlgorithmType = CipherAlgorithmType::Stream

Source§

fn iv_length() -> usize

返回IV的长度
Source§

fn key_length() -> usize

Key的长度
Source§

fn cipher_algorithm_type() -> CipherAlgorithmType

返回当前加密算法的类型(流密码还是分组密码)
Source§

impl CipherAlgorithmTrait for ChaCha20CipherAlgorithm

Source§

fn crypt(&mut self, src_data: &[u8], dst_data: &mut [u8]) -> Result<()>

加密算法原始的加密处理,对一串长度为分组长度倍数的数组进行加密 所有加密算法应强制保证完整的加密了一个分组,不应有漏加密或者剩余的情况, 也应当保证src_data和dst_data之间长度相等
Source§

impl IVKeyNewTrait for ChaCha20CipherAlgorithm

Source§

fn new(iv: &[u8], key: &[u8]) -> Result<Self>
where Self: Sized,

创建一个加密算法器

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V