aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Hash.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/concepts/Hash.ml')
-rw-r--r--lib/concepts/Hash.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/concepts/Hash.ml b/lib/concepts/Hash.ml
index 681ec4a..106e731 100644
--- a/lib/concepts/Hash.ml
+++ b/lib/concepts/Hash.ml
@@ -1,5 +1,7 @@
-type hash = bytes
+type hash = Digestif.SHA256.t
-let hash_of_value (_ : Value.value) = failwith "TODO"
-let hash_equals (_ : hash) (_ : hash) = failwith "TODO"
-let bytes_of_hash (h : hash) = h
+let hash_of_value (v : Value.value) =
+ Representation.(blob_of_value v |> bytes_of_blob) |> Digestif.SHA256.digest_bytes
+
+let hash_equals = Digestif.SHA256.equal
+let bytes_of_hash (h : hash) = Bytes.of_string (Digestif.SHA256.to_raw_string h)