Struct XofAlgorithmBuilder

Source
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

Source

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
Source

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§

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