#[non_exhaustive]pub enum DigestAlgorithm {
Sha256,
Sha384,
Sha512,
}Expand description
Supported digest algorithms for AdES signatures.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl DigestAlgorithm
impl DigestAlgorithm
Sourcepub fn oid(self) -> ObjectIdentifier
pub fn oid(self) -> ObjectIdentifier
Returns the OID for this digest algorithm.
§Example
use ades::DigestAlgorithm;
let oid = DigestAlgorithm::Sha256.oid();
assert_eq!(oid.to_string(), "2.16.840.1.101.3.4.2.1");Sourcepub fn hash(self, data: &[u8]) -> Vec<u8> ⓘ
pub fn hash(self, data: &[u8]) -> Vec<u8> ⓘ
Computes the digest of data using this algorithm.
§Example
use ades::DigestAlgorithm;
let digest = DigestAlgorithm::Sha256.hash(b"hello world");
assert_eq!(digest.len(), 32);Sourcepub fn output_len(self) -> usize
pub fn output_len(self) -> usize
Returns the output length in bytes for this algorithm.
Trait Implementations§
Source§impl Clone for DigestAlgorithm
impl Clone for DigestAlgorithm
Source§fn clone(&self) -> DigestAlgorithm
fn clone(&self) -> DigestAlgorithm
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DigestAlgorithm
Source§impl Debug for DigestAlgorithm
impl Debug for DigestAlgorithm
impl Eq for DigestAlgorithm
Source§impl PartialEq for DigestAlgorithm
impl PartialEq for DigestAlgorithm
impl StructuralPartialEq for DigestAlgorithm
Auto Trait Implementations§
impl Freeze for DigestAlgorithm
impl RefUnwindSafe for DigestAlgorithm
impl Send for DigestAlgorithm
impl Sync for DigestAlgorithm
impl Unpin for DigestAlgorithm
impl UnsafeUnpin for DigestAlgorithm
impl UnwindSafe for DigestAlgorithm
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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