diff options
Diffstat (limited to 'stdlib/digest.ml')
-rw-r--r-- | stdlib/digest.ml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/stdlib/digest.ml b/stdlib/digest.ml index e6b6b3589..14cb4ebd9 100644 --- a/stdlib/digest.ml +++ b/stdlib/digest.ml @@ -23,11 +23,15 @@ external channel: in_channel -> int -> t = "caml_md5_chan" let string str = unsafe_string str 0 (String.length str) +let bytes b = string (Bytes.unsafe_to_string b) + let substring str ofs len = if ofs < 0 || len < 0 || ofs > String.length str - len then invalid_arg "Digest.substring" else unsafe_string str ofs len +let subbytes b ofs len = substring (Bytes.unsafe_to_string b) ofs len + let file filename = let ic = open_in_bin filename in let d = channel ic (-1) in |