pub struct HmacSha256<'a>(/* private fields */);Expand description
Circuit for HMAC-SHA256.
HMAC is computed as: HMAC(key, message) = H((key ⊕ opad) || H((key ⊕ ipad) || message))
Where:
His SHA-256ipadis 0x36 repeated for the block size (512 bits)opadis 0x5c repeated for the block size (512 bits)keyis padded with zeros to the block size if shorter, or hashed if longer
This implementation uses a 512-bit key (the SHA-256 block size) to avoid needing to hash long keys. For shorter keys, pad with zeros to 512 bits before passing to this circuit.
Implementations§
Source§impl<'a> HmacSha256<'a>
impl<'a> HmacSha256<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new HmacSha256 circuit.
Trait Implementations§
Source§impl<'a, F: FancyBinary> Circuit<F> for HmacSha256<'a>where
F::Item: 'a,
impl<'a, F: FancyBinary> Circuit<F> for HmacSha256<'a>where
F::Item: 'a,
Source§impl<'a> Default for HmacSha256<'a>
impl<'a> Default for HmacSha256<'a>
Source§fn default() -> HmacSha256<'a>
fn default() -> HmacSha256<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for HmacSha256<'a>
impl<'a> RefUnwindSafe for HmacSha256<'a>
impl<'a> Send for HmacSha256<'a>
impl<'a> Sync for HmacSha256<'a>
impl<'a> Unpin for HmacSha256<'a>
impl<'a> UnsafeUnpin for HmacSha256<'a>
impl<'a> UnwindSafe for HmacSha256<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
The [
EqualityProposition] that Self == T