Digest.S(3)
π NAME π
okay bestie, welcome to Digest.S(3) from the OCaml library manual β literally the signature page for a hash function that produces digests of length hash_length from character strings, byte arrays, and files. It's giving cryptographic main character energy π
β¨
π§ Module type π§
Module type Digest.S β yes, that's the module type, no cap. π«Ά
πΈ Documentation πΈ
Module type S
= sig end
The signature for a hash function that produces digests of length hash_length from character strings, byte arrays, and files. Since 5.2 β iconic, we love a recent-era vibe. π
type t = stringβ the type of digests. Literally just astring, bestie. Slay. πval hash_length : intβ the length of digests, in bytes. No cap, that's the size vibe. β¨val compare : t -> t -> intβ compare two digests, with the same specification ascompare. Same spec energy, fr fr. π¦val equal : t -> t -> boolβ test two digests for equality. Vibe check: are they equal or not? πval string : string -> tβ return the digest of the given string. String in, digest out, periodt. πval bytes : bytes -> tβ return the digest of the given byte sequence. Byte sequence bestie, you know the drill. πΈval substring : string -> int -> int -> tβsubstring s ofs lenreturns the digest of the substring ofsstarting at indexofsand containinglencharacters. Precision slicing, we love to see it. πval subbytes : bytes -> int -> int -> tβsubbytes s ofs lenreturns the digest of the subsequence ofsstarting at indexofsand containinglenbytes. Bytes edition, same iconic energy. π¦val channel : in_channel -> int -> tβ read characters from the channel and return their digest. SeeDigest.channelfor the full specification. Go readDigest.channelif you want the whole lore. πval file : string -> tβ return the digest of the file whose name is given. File name goes in, digest comes out. πval output : out_channel -> t -> unitβ write a digest on the given output channel. Output channel said: put that digest here. πval input : in_channel -> tβ read a digest from the given input channel. Input channel said: here's your digest. β¨val to_hex : t -> stringβ return the printable hexadecimal representation of the given digest. RaisesInvalid_argumentif the length of the argument is nothash_length, and that's the whole rule. πval of_hex : string -> tβ convert a hexadecimal representation back into the corresponding digest. RaisesInvalid_argumentif the length of the argument is not2 * hash_length, or if the arguments contains non-hexadecimal characters. Hex in, digest out β but only if the vibe check passes. π₯
okay that's the whole page, bestie! this little beauty was brought to you by OCamldoc, dated 2026-06-22, and it's literally Digest.S(3) β byeee π«Άβ¨
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms