diff --git a/src/lib_protocol_environment/sigs/jbuild b/src/lib_protocol_environment/sigs/jbuild index 86d7d158f..e5ca5b696 100644 --- a/src/lib_protocol_environment/sigs/jbuild +++ b/src/lib_protocol_environment/sigs/jbuild @@ -18,6 +18,7 @@ v1/z.mli v1/lwt.mli v1/lwt_list.mli + v1/raw_hashes.mli ;; Tezos extended stdlib v1/compare.mli diff --git a/src/lib_protocol_environment/sigs/v1/raw_hashes.mli b/src/lib_protocol_environment/sigs/v1/raw_hashes.mli new file mode 100644 index 000000000..bfdde9142 --- /dev/null +++ b/src/lib_protocol_environment/sigs/v1/raw_hashes.mli @@ -0,0 +1,14 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2018. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +val blake2b : MBytes.t -> MBytes.t + +val sha256 : MBytes.t -> MBytes.t + +val sha512 : MBytes.t -> MBytes.t diff --git a/src/lib_protocol_environment/tezos_protocol_environment.ml b/src/lib_protocol_environment/tezos_protocol_environment.ml index 63d6214d0..156d55011 100644 --- a/src/lib_protocol_environment/tezos_protocol_environment.ml +++ b/src/lib_protocol_environment/tezos_protocol_environment.ml @@ -212,6 +212,11 @@ module Make (Context : CONTEXT) = struct module Format = Format module Option = Option module MBytes = MBytes + module Raw_hashes = struct + let sha256 msg = Hacl.Hash.SHA256.digest msg + let sha512 msg = Hacl.Hash.SHA512.digest msg + let blake2b msg = Blake2B.to_bytes (Blake2B.hash_bytes [ msg ]) + end module Z = struct include Z let to_bits ?(pad_to = 0) z =