aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2025-06-03 22:23:46 +0100
committerArun Isaac2025-06-26 14:50:27 +0100
commit070873a4fceb7362cb64b7c7b84a929bf4144791 (patch)
treeab7f594d3558c223bf8fd775f68075dba2597f54
parent8d45cb6cf68ec3f6648678330c50f97c949dea1a (diff)
downloadravanan-070873a4fceb7362cb64b7c7b84a929bf4144791.tar.gz
ravanan-070873a4fceb7362cb64b7c7b84a929bf4144791.tar.lz
ravanan-070873a4fceb7362cb64b7c7b84a929bf4144791.zip
work/command-line-tool: Add sha1-hash-bytes.
* ravanan/work/command-line-tool.scm (sha1-hash-bytes): New public function. (sha1-hash): Use sha1-hash-bytes.
-rw-r--r--ravanan/work/command-line-tool.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm
index d33c80c..0ba735a 100644
--- a/ravanan/work/command-line-tool.scm
+++ b/ravanan/work/command-line-tool.scm
@@ -39,6 +39,7 @@
formal-parameter-type
run-command
sha1-hash
+ sha1-hash-bytes
checksum
location->path
canonicalize-file-value
@@ -202,11 +203,14 @@ status in @var{success-codes} as success. Error out otherwise."
(with-output-to-port (current-error-port)
(cut invoke command))))))
+(define (sha1-hash-bytes file)
+ "Return the SHA1 hash of @var{file} as a bytevector."
+ (file-hash (lookup-hash-algorithm 'sha1)
+ file))
+
(define (sha1-hash file)
"Return the SHA1 hash of @var{file} as a hexadecimal string."
- (bytevector->base16-string
- (file-hash (lookup-hash-algorithm 'sha1)
- file)))
+ (bytevector->base16-string (sha1-hash-bytes file)))
(define (checksum file)
"Return the checksum of @var{file} as defined in the CWL specification."