pub struct XofAlgorithmBuilder;
Expand description
Builder for constructing XOF algorithm instances.
用于构建 XOF 算法实例的构建器。
§Usage Pattern | 使用模式
use seal_crypto_wrapper::algorithms::xof::XofAlgorithm;
// For general-purpose applications
let shake128 = XofAlgorithm::build().shake128();
// For high-security applications
let shake256 = XofAlgorithm::build().shake256();
§Performance Considerations | 性能考虑
SHAKE-128 is faster due to its higher rate (more data processed per round), while SHAKE-256 provides higher security at the cost of some performance.
SHAKE-128 由于其更高的速率(每轮处理更多数据)而更快, 而 SHAKE-256 以一些性能为代价提供更高的安全性。
Implementations§
Source§impl XofAlgorithmBuilder
impl XofAlgorithmBuilder
Sourcepub fn shake128(self) -> XofAlgorithm
pub fn shake128(self) -> XofAlgorithm
Selects SHAKE-128 extendable output function.
选择 SHAKE-128 可扩展输出函数。
§Properties | 属性
- Security level: 128-bit
- Rate: 1344 bits (168 bytes per round)
- Capacity: 256 bits
- Performance: High
§Use Cases | 使用场景
-
General-purpose key derivation
-
Random number generation
-
Stream cipher keystreams
-
Mask generation functions
-
通用密钥派生
-
随机数生成
-
流密码密钥流
-
掩码生成函数
§Examples | 示例
use seal_crypto_wrapper::algorithms::xof::XofAlgorithm;
use seal_crypto_wrapper::prelude::XofAlgorithmTrait;
let xof = XofAlgorithm::build().shake128();
let wrapper = xof.into_wrapper();
// Generate variable-length output
let mut reader = wrapper.reader(b"input data", None, None)?;
let output = reader.read_boxed(32); // 32 bytes of output
Sourcepub fn shake256(self) -> XofAlgorithm
pub fn shake256(self) -> XofAlgorithm
Selects SHAKE-256 extendable output function.
选择 SHAKE-256 可扩展输出函数。
§Properties | 属性
- Security level: 256-bit
- Rate: 1088 bits (136 bytes per round)
- Capacity: 512 bits
- Performance: Medium
§Use Cases | 使用场景
-
High-security key derivation
-
Long-term cryptographic applications
-
Post-quantum security preparations
-
High-value data protection
-
高安全性密钥派生
-
长期密码应用
-
后量子安全准备
-
高价值数据保护
§Examples | 示例
use seal_crypto_wrapper::algorithms::xof::XofAlgorithm;
use seal_crypto_wrapper::prelude::XofAlgorithmTrait;
let xof = XofAlgorithm::build().shake256();
let wrapper = xof.into_wrapper();
// Generate large amounts of pseudorandom data
let mut reader = wrapper.reader(b"seed", Some(b"salt"), Some(b"info"))?;
let large_output = reader.read_boxed(1024); // 1KB of output
Auto Trait Implementations§
impl Freeze for XofAlgorithmBuilder
impl RefUnwindSafe for XofAlgorithmBuilder
impl Send for XofAlgorithmBuilder
impl Sync for XofAlgorithmBuilder
impl Unpin for XofAlgorithmBuilder
impl UnwindSafe for XofAlgorithmBuilder
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