diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/interop.ml | 9 |
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 |
