1Digest(3) OCaml library Digest(3)
2
3
4
6 Digest - MD5 message digest.
7
9 Module Digest
10
12 Module Digest
13 : sig end
14
15
16 MD5 message digest.
17
18 This module provides functions to compute 128-bit ``digests'' of arbi‐
19 trary-length strings or files. The digests are of cryptographic qual‐
20 ity: it is very hard, given a digest, to forge a string having that
21 digest. The algorithm used is MD5.
22
23
24
25
26
27
28 type t = string
29
30
31 The type of digests: 16-character strings.
32
33
34
35
36 val string : string -> t
37
38 Return the digest of the given string.
39
40
41
42
43 val substring : string -> int -> int -> t
44
45
46 Digest.substring s ofs len returns the digest of the substring of s
47 starting at character number ofs and containing len characters.
48
49
50
51
52 val channel : Pervasives.in_channel -> int -> t
53
54 If len is nonnegative, Digest.channel ic len reads len characters from
55 channel ic and returns their digest, or raises End_of_file if
56 end-of-file is reached before len characters are read. If len is nega‐
57 tive, Digest.channel ic len reads all characters from ic until
58 end-of-file is reached and return their digest.
59
60
61
62
63 val file : string -> t
64
65 Return the digest of the file whose name is given.
66
67
68
69
70 val output : Pervasives.out_channel -> t -> unit
71
72 Write a digest on the given output channel.
73
74
75
76
77 val input : Pervasives.in_channel -> t
78
79 Read a digest from the given input channel.
80
81
82
83
84 val to_hex : t -> string
85
86 Return the printable hexadecimal representation of the given digest.
87
88
89
90
91
92
93OCamldoc 2017-03-22 Digest(3)