identity_iota::sd_jwt_payload

Trait Hasher

pub trait Hasher: Sync + Send {
    // Required methods
    fn digest(&self, input: &[u8]) -> Vec<u8> ;
    fn alg_name(&self) -> &'static str;

    // Provided method
    fn encoded_digest(&self, disclosure: &str) -> String { ... }
}
Expand description

Used to implement hash functions to be used for encoding/decoding.

§Note

Implementations of this trait are expected only for algorithms listed in the IANA “Named Information Hash Algorithm” registry. See Hash Function Claim

Required Methods§

fn digest(&self, input: &[u8]) -> Vec<u8>

Digests input to produce unique fixed-size hash value in bytes.

fn alg_name(&self) -> &'static str

Returns the name of hash function used.

§Note

The hash algorithm identifier MUST be a hash algorithm value from the “Hash Name String” column in the IANA “Named Information Hash Algorithm”

Provided Methods§

fn encoded_digest(&self, disclosure: &str) -> String

Returns the base64url-encoded digest of a disclosure.

Implementors§