aboutsummaryrefslogblamecommitdiffstats
path: root/lib/interop.ml
blob: ea25e0ce74143c4b9d25084a065197e778432141 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                      

                               




                                                                        
open Ctypes

module Sha256 = struct
  type t = string
  let compute_hash content: t =
    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