hypersig/digest

Types

pub type Digest {
  Digest(method: crypto.HashAlgorithm, digest: BitArray)
}

Constructors

pub type DigestHeader =
  List(Digest)

Values

pub fn from_string(
  header: String,
) -> Result(Digest, error.HyperError)

Parse a Digest from a string

pub fn new(data: BitArray) -> Digest

Hashes the data using Sha256 and creates a Digest object

pub fn parse_header(
  header: String,
) -> Result(List(Digest), error.HyperError)

Parses a comma-separated list of digest strings into a list of Digest objects

pub fn to_string(header: Digest) -> String

Format a Digest as <method>=<base64 encoded digest>

pub fn verify(digest: Digest, data: BitArray) -> Bool

Verifies the given digest object matches the given data

pub fn verify_header(
  header: List(Digest),
  data: BitArray,
) -> Bool

Verify all digests in a given header against the given data

pub fn with_method(
  method: crypto.HashAlgorithm,
  data: BitArray,
) -> Digest

Hashes the data with the given method and creates a Digest object

Search Document