aboutsummaryrefslogtreecommitdiffstats
path: root/lib/interop.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-03-05 23:42:15 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-03-05 23:42:15 -0300
commit8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5 (patch)
tree84f9ddd9e41236fb7a6f540aab07e65db9bc93cb /lib/interop.ml
parent295c6a5a1f2b0db9d756ffe7bf413553a0c02737 (diff)
downloadSakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.tar.gz
Sakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.zip
ocaml re-migration
Diffstat (limited to 'lib/interop.ml')
-rw-r--r--lib/interop.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/interop.ml b/lib/interop.ml
new file mode 100644
index 0000000..3b7a3d2
--- /dev/null
+++ b/lib/interop.ml
@@ -0,0 +1,9 @@
+open Ctypes
+
+module Sha256 = struct
+ let compute_hash content =
+ let size_with_null_terminator = C.Types.hash_size + 1 in
+ let buf = Ctypes.allocate_n char ~count:size_with_null_terminator in
+ let () = C.Functions.compute_hash buf (Bytes.to_string content) in
+ Ctypes.coerce (ptr char) Ctypes.string buf
+end