pub struct SecretKey { /* private fields */ }
Expand description

A type to represent the SecretKey that BLAKE2b uses for keyed mode.

Note:

SecretKey pads the secret key for use with BLAKE2b, when initialized.

Exceptions:

An exception will be thrown if:

  • slice is empty.
  • slice is greater than 64 bytes.
  • The OsRng fails to initialize or read from its source.

Security:

  • Avoid using unprotected_as_bytes() whenever possible, as it breaks all protections that the type implements.

Implementations§

Make an object from a given byte slice.

Get the original size of the key, before padding.

Randomly generate using a CSPRNG. Not available in no_std context.

Return the object as byte slice. Warning: Should not be used unless strictly needed. This breaks protections that the type implements.

Return the length of the object.

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.