| 1 |
(**************************************************************************) |
| 2 |
(* *) |
| 3 |
(* Copyright 2016-2018 OCamlPro *) |
| 4 |
(* *) |
| 5 |
(* All rights reserved. This file is distributed under the terms of the *) |
| 6 |
(* GNU Lesser General Public License version 2.1, with the special *) |
| 7 |
(* exception on linking described in the file LICENSE. *) |
| 8 |
(* *) |
| 9 |
(**************************************************************************) |
| 10 |
|
| 11 |
let sha1_file file = Sha1.to_hex (Sha1.file file) |
| 12 |
let sha256_file file = Sha256.to_hex (Sha256.file file) |
| 13 |
let sha512_file file = Sha512.to_hex (Sha512.file file) |
| 14 |
let hash_file = function |
| 15 |
| `SHA1 -> sha1_file |
| 16 |
| `SHA256 -> sha256_file |
| 17 |
| `SHA512 -> sha512_file |
| 18 |
|
| 19 |
let sha1_string str = Sha1.to_hex (Sha1.string str) |
| 20 |
let sha256_string str = Sha256.to_hex (Sha256.string str) |
| 21 |
let sha512_string str = Sha512.to_hex (Sha512.string str) |
| 22 |
let hash_string = function |
| 23 |
| `SHA1 -> sha1_string |
| 24 |
| `SHA256 -> sha256_string |
| 25 |
| `SHA512 -> sha512_string |