Module Maki.Hash

module Sha : module type of Sha1
type 'a t = Sha.ctx ‑> 'a ‑> unit
val unit : unit t
val int : int t
val bool : bool t
val string : string t
val float : float t
val list : 'a t ‑> 'a list t
val array : 'a t ‑> 'a array t
val map : ('a ‑> 'b) ‑> 'b t ‑> 'a t

map f hash x encodes x using f, and then uses hash to hash f x.

val file_ref : File_ref.t t

How to hash a file ref

val program_ref : Program_ref.t t

How to hash a program ref

val set : 'a t ‑> 'a list t

set op is similar to list, except the order of elements does not matter.

val marshal : 'a t

Encode the data into a string using marshal, then hash the string. Caution, this is somewhat unsafe, but useful for quick-and-dirty work.

val pair : 'a t ‑> 'b t ‑> ('a * 'b) t
val triple : 'a t ‑> 'b t ‑> 'c t ‑> ('a * 'b * 'c) t
val quad : 'a t ‑> 'b t ‑> 'c t ‑> 'd t ‑> ('a * 'b * 'c * 'd) t
val hash : 'a t ‑> 'a ‑> Sha.t

Hash a value.

val hash_to_string : 'a t ‑> 'a ‑> string

Hash a value, then encode the hash into a string.

val of_codec : 'a Codec.t ‑> 'a t

Hashing by encoding, then hashing the encoded value