Struct digest_headers::Digest [] [src]

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.

Methods

impl Digest
[src]

[src]

Creates a new Digest from a series of bytes representing a plaintext body and a ShaSize.

Example

let body = "Here's some text!";
let digest = Digest::new(body.as_bytes(), ShaSize::TwoFiftySix);

println!("Digest: {}", digest);

[src]

Creates a new Digest from a base64-encoded digest String and a ShaSize.

Example

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);

[src]

Get the ShaSize of the current Digest

[src]

Represents the Digest as a String.

This can be used to produce headers for HTTP Requests.

Example

let digest = Digest::new(b"Hello, world!", ShaSize::TwoFiftySix);

println!("Digest: {}", digest.as_string());

[src]

Verify a given message body with the digest.

Example

let body = b"Some message body";
let digest = Digest::new(body, ShaSize::TwoFiftySix);

assert!(digest.verify(body).is_ok());

Trait Implementations

impl Clone for Digest
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Digest
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for Digest
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for Digest
[src]

impl FromStr for Digest
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

impl Display for Digest
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Digest

impl Sync for Digest