From d0a92b7531274a71352c3620a77cbe81b18b7232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 1 Jun 2012 23:29:55 +0200 Subject: [PATCH] Move `sha256' to (guix utils). * guix/derivations.scm (sha256): Move to... * guix/utils.scm (sha256): ... here. --- guix/derivations.scm | 6 ------ guix/utils.scm | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/guix/derivations.scm b/guix/derivations.scm index 9bdcdacf1f..3faffd0e61 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -25,9 +25,6 @@ (define-module (guix derivations) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) #:use-module (guix store) - #:use-module ((chop hash) - #:select (bytevector-hash - hash-method/sha256)) #:export (derivation? derivation-outputs derivation-inputs @@ -187,9 +184,6 @@ (define (write-list lst) env-vars)) (display ")" port)))) -(define (sha256 bv) - "Return the SHA256 of BV as a bytevector." - (bytevector-hash hash-method/sha256 bv)) (define (derivation-hash drv) ; `hashDerivationModulo' in derivations.cc "Return the hash of DRV, modulo its fixed-output inputs, as a bytevector." 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 @@ (define bytevector->base32-string (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)) +