1Stdlib.Digest(3) OCaml library Stdlib.Digest(3)
2
3
4
6 Stdlib.Digest - no description
7
9 Module Stdlib.Digest
10
12 Module Digest
13 : (module Stdlib__digest)
14
15
16
17
18
19
20
21 type t = string
22
23
24 The type of digests: 16-character strings.
25
26
27
28 val compare : t -> t -> int
29
30 The comparison function for 16-character digest, with the same specifi‐
31 cation as compare and the implementation shared with String.compare .
32 Along with the type t , this function compare allows the module Digest
33 to be passed as argument to the functors Set.Make and Map.Make .
34
35
36 Since 4.00.0
37
38
39
40 val equal : t -> t -> bool
41
42 The equal function for 16-character digest.
43
44
45 Since 4.03.0
46
47
48
49 val string : string -> t
50
51 Return the digest of the given string.
52
53
54
55 val bytes : bytes -> t
56
57 Return the digest of the given byte sequence.
58
59
60 Since 4.02.0
61
62
63
64 val substring : string -> int -> int -> t
65
66
67 Digest.substring s ofs len returns the digest of the substring of s
68 starting at index ofs and containing len characters.
69
70
71
72 val subbytes : bytes -> int -> int -> t
73
74
75 Digest.subbytes s ofs len returns the digest of the subsequence of s
76 starting at index ofs and containing len bytes.
77
78
79 Since 4.02.0
80
81
82
83 val channel : in_channel -> int -> t
84
85 If len is nonnegative, Digest.channel ic len reads len characters from
86 channel ic and returns their digest, or raises End_of_file if
87 end-of-file is reached before len characters are read. If len is nega‐
88 tive, Digest.channel ic len reads all characters from ic until
89 end-of-file is reached and return their digest.
90
91
92
93 val file : string -> t
94
95 Return the digest of the file whose name is given.
96
97
98
99 val output : out_channel -> t -> unit
100
101 Write a digest on the given output channel.
102
103
104
105 val input : in_channel -> t
106
107 Read a digest from the given input channel.
108
109
110
111 val to_hex : t -> string
112
113 Return the printable hexadecimal representation of the given digest.
114 Raise Invalid_argument if the argument is not exactly 16 bytes.
115
116
117
118 val from_hex : string -> t
119
120 Convert a hexadecimal representation back into the corresponding
121 digest. Raise Invalid_argument if the argument is not exactly 32 hexa‐
122 decimal characters.
123
124
125 Since 4.00.0
126
127
128
129
130
131OCamldoc 2020-02-27 Stdlib.Digest(3)