aboutsummaryrefslogtreecommitdiff
path: root/guix/hash.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/hash.scm')
-rw-r--r--guix/hash.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/guix/hash.scm b/guix/hash.scm
index fb85f47586..593c2e1aee 100644
--- a/guix/hash.scm
+++ b/guix/hash.scm
@@ -26,6 +26,7 @@
#:export (sha256
open-sha256-port
port-sha256
+ file-sha256
open-sha256-input-port))
;;; Commentary:
@@ -129,6 +130,10 @@ output port."
(close-port out)
(get)))
+(define (file-sha256 file)
+ "Return the SHA256 hash (a bytevector) of FILE."
+ (call-with-input-file file port-sha256))
+
(define (open-sha256-input-port port)
"Return an input port that wraps PORT and a thunk to get the hash of all the
data read from PORT. The thunk always returns the same value."