Skip to main content

Module xof_factory

Module xof_factory 

Source
Expand description

XOF factory for creating instances of algorithms that implement the XOF trait.

As with all Factory objects, this implements constructions from strings and defaults, and returns a XOFFactory object which itself implements the XOF trait as a pass-through to the underlying algorithm.

Example usage:

use core_interface::traits::XOF;
use factory::AlgorithmFactory;
use factory::xof_factory::XOFFactory;

let data: &[u8] = b"Hello, world!";

let mut h = XOFFactory::new(sha3::SHAKE128_NAME).unwrap();
h.absorb(data).unwrap();
let output: Vec<u8> = h.squeeze(16).unwrap();

You can equivalently invoke this by string instead of using the constant:

use factory::AlgorithmFactory;
use factory::xof_factory::XOFFactory;

let mut h = XOFFactory::new("SHAKE128").unwrap();

Or, if you don’t particularly care which algorithm you get, you can use the configured default:

use factory::AlgorithmFactory;
use factory::xof_factory::XOFFactory;

let mut h = XOFFactory::default();

Enums§

XOFFactory

Constants§

DEFAULT_128BIT_XOF_NAME
DEFAULT_256BIT_XOF_NAME
DEFAULT_XOF_NAME