summaryrefslogtreecommitdiff
path: root/guix/hash.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-01-11 09:38:49 -0500
committerMark H Weaver <mhw@netris.org>2015-01-11 09:38:49 -0500
commit77448857311318fc9cd866afcb85ca98fccdb25b (patch)
treeefed3a71d1f7b2c2cc292e7e4ba1884c4d26a9e4 /guix/hash.scm
parent62c155c0bcbc0d71b1bc35e966193b6e8de03246 (diff)
parent0009ed71ad288358cbc7828954b5e1a3f18fd525 (diff)
Merge branch 'master' into core-updates
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."