aboutsummaryrefslogtreecommitdiffstats
path: root/lib/conventions.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-05-02 03:41:35 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-05-02 03:41:35 +0000
commit02bdd7a470143977848c9841b46386083f4ce9c5 (patch)
tree11c510c2e3247fe1c6fb52fe47d8009ee5f0443d /lib/conventions.ml
parentc6a0b4483e4c2c06c62466d726733b7b26759cec (diff)
downloadSakura-02bdd7a470143977848c9841b46386083f4ce9c5.tar.gz
Sakura-02bdd7a470143977848c9841b46386083f4ce9c5.zip
Hashes are not strings, but we can pretend otherwise (for now)
Diffstat (limited to 'lib/conventions.ml')
-rw-r--r--lib/conventions.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/conventions.ml b/lib/conventions.ml
index fe85737..c048639 100644
--- a/lib/conventions.ml
+++ b/lib/conventions.ml
@@ -1,9 +1,11 @@
module Hash = struct
- type t = string
+ type t = string (* Sha256.t *)
- let hash_text text = Sha256.to_hex (Sha256.string text)
+ (* FIXME: this is terrible *)
+ let hash_text text = Sha256.to_bin (Sha256.string text)
+ let to_string x = Sha256.to_hex (Sha256.of_bin (String.to_bytes x))
let compare = String.compare
- let sexp_of_t = Sexplib.Std.sexp_of_string
+ let sexp_of_t x = Sexplib.Std.sexp_of_string (to_string x)
end
module Name = struct
@@ -27,7 +29,7 @@ module AbstractValue = struct
type t = Obj.t
let hash (elem : t) =
- Sha256.to_hex (Sha256.string (Bytes.to_string (Marshal.to_bytes elem [])))
+ Hash.hash_text (Bytes.to_string (Marshal.to_bytes elem []))
let sexp_of_t (v : t) =
let open Sexplib.Sexp in