summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-01 23:29:55 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-03 20:26:45 +0200
commitd0a92b7531274a71352c3620a77cbe81b18b7232 (patch)
tree89fb2986338e019aaff8eda5acfb193d0ccf8998 /guix/utils.scm
parente87088c9d5fccaadb6a1b112b8791b5d0cd74a67 (diff)
downloadgnu-guix-d0a92b7531274a71352c3620a77cbe81b18b7232.tar
gnu-guix-d0a92b7531274a71352c3620a77cbe81b18b7232.tar.gz
Move `sha256' to (guix utils).
* guix/derivations.scm (sha256): Move to... * guix/utils.scm (sha256): ... here.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 69abcb4b55..db37d432e8 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -19,9 +19,13 @@
(define-module (guix utils)
#:use-module (srfi srfi-60)
#:use-module (rnrs bytevectors)
+ #:use-module ((chop hash)
+ #:select (bytevector-hash
+ hash-method/sha256))
#:export (bytevector-quintet-length
bytevector->base32-string
- bytevector->nix-base32-string))
+ bytevector->nix-base32-string
+ sha256))
(define bytevector-quintet-ref
(let* ((ref bytevector-u8-ref)
@@ -98,3 +102,12 @@ the previous application or INIT."
(define bytevector->nix-base32-string
(make-bytevector->base32-string %nix-base32-chars))
+
+;;;
+;;; Hash.
+;;;
+
+(define (sha256 bv)
+ "Return the SHA256 of BV as a bytevector."
+ (bytevector-hash hash-method/sha256 bv))
+