pub struct MacTag(pub [u8; 32]);
Tuple Fields§
§0: [u8; 32]
Implementations§
Source§impl MacTag
impl MacTag
Sourcepub fn from_slice(bs: &[u8]) -> Option<MacTag>
pub fn from_slice(bs: &[u8]) -> Option<MacTag>
from_slice()
creates an object from a byte slice
This function will fail and return None
if the length of
the byte-s;ice isn’t equal to the length of the object
pub fn from_rng<R: Rng + ?Sized>(rng: &mut R) -> MacTag
pub fn to_hex(&self) -> String
Trait Implementations§
Source§impl ConstantTimeEq for MacTag
impl ConstantTimeEq for MacTag
Source§impl<'de> Deserialize<'de> for MacTag
impl<'de> Deserialize<'de> for MacTag
Source§fn deserialize<D>(deserializer: D) -> Result<MacTag, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<MacTag, D::Error>where
D: Deserializer<'de>,
Source§impl Distribution<MacTag> for Standard
impl Distribution<MacTag> for Standard
Source§impl Index<Range<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
impl Index<Range<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
WARNING: it might be tempting to do comparisons on objects
by using x[a..b] == y[a..b]
. This will open up for timing attacks
when comparing for example authenticator tags. Because of this only
use the comparison functions exposed by the sodiumoxide API.
Source§impl Index<RangeFrom<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
impl Index<RangeFrom<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
WARNING: it might be tempting to do comparisons on objects
by using x[a..] == y[a..]
. This will open up for timing attacks
when comparing for example authenticator tags. Because of this only
use the comparison functions exposed by the sodiumoxide API.
Source§impl Index<RangeFull> for MacTag
Allows a user to access the byte contents of an object as a slice.
impl Index<RangeFull> for MacTag
Allows a user to access the byte contents of an object as a slice.
WARNING: it might be tempting to do comparisons on objects
by using x[] == y[]
. This will open up for timing attacks
when comparing for example authenticator tags. Because of this only
use the comparison functions exposed by the sodiumoxide API.
Source§impl Index<RangeTo<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
impl Index<RangeTo<usize>> for MacTag
Allows a user to access the byte contents of an object as a slice.
WARNING: it might be tempting to do comparisons on objects
by using x[..b] == y[..b]
. This will open up for timing attacks
when comparing for example authenticator tags. Because of this only
use the comparison functions exposed by the sodiumoxide API.