package opam-core

  1. Overview
  2. Docs
type kind = [
  1. | `MD5
  2. | `SHA256
  3. | `SHA512
]

Stored as hexadecimal strings

type t
val kind : t -> kind
val contents : t -> string

The value of the hash, as a string of hexadecimal characters

val string_of_kind : kind -> string
val md5 : string -> t
val sha256 : string -> t
val sha512 : string -> t
include OpamStd.ABSTRACT with type t := t
val of_string : string -> t
val to_string : t -> string
val to_json : t -> OpamJson.t
val of_json : OpamJson.t -> t option
module Set : OpamStd.SET with type elt = t
module Map : OpamStd.MAP with type key = t
val of_string_opt : string -> t option
val to_path : t -> string list

returns a sub-path specific to this hash, e.g. "md5/d4/d41d8cd98f00b204e9800998ecf8427e", as a list

val check_file : string -> t -> bool
val mismatch : string -> t -> t option

Like check_file, but returns the actual mismatching hash of the file, or None in case of match

val compute : ?kind:kind -> string -> t

Compute hash of the given file

val compute_from_string : ?kind:kind -> string -> t

Compute the hash of the given string

OCaml

Innovation. Community. Security.