Skip to main content

SHA2_256_x86

Struct SHA2_256_x86 

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

An x86 and x86_64 optimized implementation of the SHA2_256 algorithm.

This implementation is only available on x86 and x86_64 targets. The code will panic if the target is invalid.

§Safety

This implementation does not verify that the target supports the required instructions. In particular sha,sse4.1 features have to be supported. Otherwise the code will likely crash at runtime.

Implementations§

Source§

impl SHA2_256_x86

Source

pub const fn new() -> Self

Creates a new SHA2_256_x86 instance.

§Panics

If target_arch is neither x86 nor x86_64.

Source

pub fn update(&mut self, data: impl AsRef<[u8]>)

Writes a block of data to the underlying state.

Source

pub fn result(&self, output: &mut [u8; 32])

Calculates the final hash value.

Trait Implementations§

Source§

impl Default for SHA2_256_x86

Source§

fn default() -> Self

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

impl From<SHA2_256_Portable> for SHA2_256_x86

Source§

fn from(portable: SHA2_256_Portable) -> Self

Converts to this type from the input type.
Source§

impl From<SHA2_256_x86> for SHA2_256_Portable

Source§

fn from(x86: SHA2_256_x86) -> Self

Converts to this type from the input type.
Source§

impl HashFunction for SHA2_256_x86

Source§

type Output = [u8; 32]

Source§

fn update(&mut self, data: impl AsRef<[u8]>)

Updates the internal state of the HashFunction with given data.
Source§

fn write_result(&self, output: &mut Self::Output)

Writes the final result to the output passed as ref parameter.
Source§

fn result(&self) -> Self::Output

A wrapper around HashFunction::write_result that returns the hash instead of writing it to output parameter.
Source§

impl ReprC for SHA2_256_x86

Source§

const CHECK: ()

This field is used for const checks only.

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.