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 compare : t -> t -> int
val equal : t -> t -> bool
val of_string : string -> t
val to_string : t -> string
val to_json : t OpamJson.encoder
val of_json : t OpamJson.decoder
module Set : OpamStd.SET with type elt = t
module Map : OpamStd.MAP with type key = t
val of_string_opt : string -> t option
val is_null : t -> bool

Check if hash contains only 0

val to_path : t -> string list

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

val sort : t list -> t list

Sorts the list from best hash (SHA512, ...) to weakest (..., MD5)

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.