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
impl KdfAlgorithm
Sourcepub fn build() -> KdfAlgorithmBuilder
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
impl<'__de, __Context> BorrowDecode<'__de, __Context> for KdfAlgorithm
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for KdfAlgorithm
impl Clone for KdfAlgorithm
Source§fn clone(&self) -> KdfAlgorithm
fn clone(&self) -> KdfAlgorithm
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more