aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/util.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/bash/util.sh b/bash/util.sh
index cdf4fd5..4fc11ab 100644
--- a/bash/util.sh
+++ b/bash/util.sh
@@ -24,9 +24,9 @@ extract () {
merkle-tree () {
dirname="${1-.}"
- find "$dirname" -type f | \ # get all files in the $dirname tree
- sort | \ # sort them to get the same result on different filesystems
- xargs sha256sum | \ # compute the SHA256 of each file, BONUS it outputs the filename, so if the content does not change but the filename does, the end hash will be different
- sha256sum | \ # compute the final hash
- awk '{print $1}' # omit the filename, which is `-` as stdin in this case
+ find "$dirname" -type f | \
+ sort | \
+ xargs -I{} sha256sum "{}" | \
+ sha256sum | \
+ awk '{print $1}'
}