Skip to main content

XorHash

Struct XorHash 

Source
pub struct XorHash { /* private fields */ }
Expand description

One-byte XOR-fold hash. State is a single accumulator byte.

Implementations§

Source§

impl XorHash

Source

pub fn new() -> Self

Construct an empty accumulator. Exposed for tests that want to bypass the trait create_with_opts path.

Trait Implementations§

Source§

impl Default for XorHash

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HashPlugin for XorHash

Source§

fn create_with_opts( _name: &str, _opts: Option<OptionView<'_>>, ) -> PluginResult<Self>

Construct a new hash instance for the named algorithm. Read more
Source§

fn output_size(&self) -> u32

Output length in bytes for this instance. The caller allocates a buffer of this size before calling finalize.
Source§

fn block_size(&self) -> u32

Internal block size in bytes. Used by callers that want to feed input in aligned chunks; safe to return a constant (e.g. 64) if the algorithm doesn’t have a meaningful block size.
Source§

fn update(&mut self, data: &[u8]) -> PluginResult<()>

Absorb data into the hash state.
Source§

fn reset(&mut self) -> PluginResult<()>

Reset to the initial state (post-create).
Source§

fn try_clone(&self) -> PluginResult<Self>

Duplicate the hash state. The clone must be independent: updates to one must not affect the other.
Source§

fn finalize(&mut self, out: &mut [u8]) -> PluginResult<()>

Write the finalized digest into out. The caller guarantees out.len() == self.output_size(). Plugins that need to pad or finalize internally should do so here.

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, 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.