aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hashing.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-06-23 23:53:26 -0300
committerGitHub <noreply@github.com>2026-06-23 23:53:26 -0300
commitc284fcd570342c31bc21169960579a20a763e32e (patch)
treece7485055116d794c55090ad0978e0b3f5ff4c2a /lib/hashing.ml
parentb81586ee4a0543a5f9866586c78dccdd6328934a (diff)
downloadSakura-c284fcd570342c31bc21169960579a20a763e32e.tar.gz
Sakura-c284fcd570342c31bc21169960579a20a763e32e.zip
Format
Diffstat (limited to 'lib/hashing.ml')
-rw-r--r--lib/hashing.ml10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/hashing.ml b/lib/hashing.ml
index ff8436b..cc4bf10 100644
--- a/lib/hashing.ml
+++ b/lib/hashing.ml
@@ -16,9 +16,7 @@ let bytes_to_hex bytes =
let hi = c lsr 4 in
let lo = c land 0xf in
Bytes.set hex (i * 2) (Char.chr (if hi < 10 then hi + 48 else hi + 87));
- Bytes.set hex
- ((i * 2) + 1)
- (Char.chr (if lo < 10 then lo + 48 else lo + 87))
+ Bytes.set hex ((i * 2) + 1) (Char.chr (if lo < 10 then lo + 48 else lo + 87))
done;
Bytes.to_string hex
@@ -35,11 +33,9 @@ let hash_tuple (tuple : Tuple.materialized) : Conventions.Hash.t =
List.fold_left
(fun acc (name, attr) ->
(* Marshal the value and hex-encode to avoid null bytes *)
- let value_bytes =
- Marshal.to_bytes attr.Attribute.value [ Marshal.Closures ]
- in
+ let value_bytes = Marshal.to_bytes attr.Attribute.value [Marshal.Closures] in
let value_hex = bytes_to_hex value_bytes in
- acc ^ name ^ ":" ^ value_hex ^ ";")
+ acc ^ name ^ ":" ^ value_hex ^ ";" )
(tuple.relation ^ "|") sorted_attrs
in
Conventions.Hash.hash_text content