blob: 3b7a3d20645cb826f0f09ad2ee10f841a8ada6cf (
plain) (
blame)
1
2
3
4
5
6
7
8
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
|