Enum KdfAlgorithm

Source
pub enum KdfAlgorithm {
    Key(KdfKeyAlgorithm),
    Password(KdfPasswordAlgorithm),
}
Expand description

Key Derivation Function algorithm enumeration.

密钥派生函数算法枚举。

§Algorithm Selection | 算法选择

This enum provides access to two main categories of KDF algorithms:

此枚举提供对两个主要 KDF 算法类别的访问:

  • Key-based: For deriving keys from existing high-entropy key material

  • Password-based: For deriving keys from user passwords or low-entropy sources

  • 基于密钥: 用于从现有高熵密钥材料派生密钥

  • 基于密码: 用于从用户密码或低熵源派生密钥

§Usage Examples | 使用示例

use seal_crypto_wrapper::algorithms::kdf::KdfAlgorithm;

// Key-based derivation (high entropy input)
let hkdf = KdfAlgorithm::build().key().hkdf_sha256();

// Password-based derivation (low entropy input)
let pbkdf2 = KdfAlgorithm::build().passwd().pbkdf2_sha256_with_params(10000);
let argon2 = KdfAlgorithm::build().passwd().argon2_with_params(65536, 3, 4);

Variants§

§

Key(KdfKeyAlgorithm)

Key-based derivation functions for high-entropy inputs.

用于高熵输入的基于密钥的派生函数。

Suitable when the input key material already has sufficient entropy, such as cryptographic keys, shared secrets, or random values.

适用于输入密钥材料已具有足够熵的情况, 如密码密钥、共享密钥或随机值。

§

Password(KdfPasswordAlgorithm)

Password-based derivation functions for low-entropy inputs.

用于低熵输入的基于密码的派生函数。

Designed to handle user passwords and other low-entropy sources, with built-in protection against brute-force attacks.

设计用于处理用户密码和其他低熵源, 内置对暴力攻击的保护。

Implementations§

Source§

impl KdfAlgorithm

Source

pub fn build() -> KdfAlgorithmBuilder

Creates a new KDF algorithm builder.

创建新的 KDF 算法构建器。

§Returns | 返回值

A builder that provides access to both key-based and password-based derivation functions. Use the builder methods to select the appropriate category for your use case.

提供访问基于密钥和基于密码的派生函数的构建器。 使用构建器方法为您的用例选择适当的类别。

§Examples | 示例
use seal_crypto_wrapper::algorithms::kdf::KdfAlgorithm;

// Access key-based KDF algorithms
let key_builder = KdfAlgorithm::build().key();

// Access password-based KDF algorithms
let passwd_builder = KdfAlgorithm::build().passwd();

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for KdfAlgorithm

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for KdfAlgorithm

Source§

fn clone(&self) -> KdfAlgorithm

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KdfAlgorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<__Context> Decode<__Context> for KdfAlgorithm

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl<'de> Deserialize<'de> for KdfAlgorithm

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Encode for KdfAlgorithm

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl Hash for KdfAlgorithm

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for KdfAlgorithm

Source§

fn eq(&self, other: &KdfAlgorithm) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for KdfAlgorithm

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for KdfAlgorithm

Source§

impl Eq for KdfAlgorithm

Source§

impl StructuralPartialEq for KdfAlgorithm

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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

Source§

impl<T> ConditionallySerde for T
where T: Serialize + for<'de> Deserialize<'de>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,