pub struct Digest { /* fields omitted */ }Defines the Digest type.
This type can be compared to another Digest, or turned into a String for use in request
headers.
Creates a new Digest from a series of bytes representing a plaintext body and a
ShaSize.
let body = "Here's some text!";
let digest = Digest::new(body.as_bytes(), ShaSize::TwoFiftySix);
println!("Digest: {}", digest);
Creates a new Digest from a base64-encoded digest String and a ShaSize.
let sha_size = ShaSize::TwoFiftySix;
let digest_str = "bFp1K/TT36l9YQ8frlh/cVGuWuFEy1rCUNpGwQCSEow=";
let digest = Digest::from_base64_and_size(digest_str.to_owned(), sha_size);
println!("Digest: {}", digest);
Get the ShaSize of the current Digest
Represents the Digest as a String.
This can be used to produce headers for HTTP Requests.
let digest = Digest::new(b"Hello, world!", ShaSize::TwoFiftySix);
println!("Digest: {}", digest.as_string());
Verify a given message body with the digest.
let body = b"Some message body";
let digest = Digest::new(body, ShaSize::TwoFiftySix);
assert!(digest.verify(body).is_ok());
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=.
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
🔬 This is a nightly-only experimental API. (try_from)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from)
🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static