Skip to content

Commit efd2b39

Browse files
committed
Create a module for hash sum helpers
1 parent e2b1c3b commit efd2b39

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/cache.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ open Defaults
1919
and also because almost no one uses it — and I like to be contrarian,
2020
at least when it doesn't harm anyone else. ;)
2121
*)
22-
let hash_sum s =
23-
let ctx = Digestif.BLAKE2S.empty in
24-
let ctx = Digestif.BLAKE2S.feed_string ctx s in
25-
Digestif.BLAKE2S.get ctx |> Digestif.BLAKE2S.to_hex
22+
let hash_sum = Hash.blake2s
2623

2724
let read_file path =
2825
try Soup.read_file path

src/helpers/hash.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(* Simple wrappers for hash functions from Digestif
2+
that just take a string and return a hex digest.
3+
*)
4+
5+
let blake2s s =
6+
let ctx = Digestif.BLAKE2S.empty in
7+
let ctx = Digestif.BLAKE2S.feed_string ctx s in
8+
Digestif.BLAKE2S.get ctx |> Digestif.BLAKE2S.to_hex
9+
10+
11+

0 commit comments

Comments
 (0)