From 7dea1c7799b7d57f56bad3f81389d8a150220c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 3 Mar 2022 02:32:04 +0100 Subject: Rewrote checksum->string. Lets take full advantage of guile's format. --- module/crypto.scm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'module/crypto.scm') diff --git a/module/crypto.scm b/module/crypto.scm index 6428f16d..79eaaf89 100644 --- a/module/crypto.scm +++ b/module/crypto.scm @@ -28,11 +28,7 @@ ((@ (system foreign) bytevector->pointer) md)) md) -(define (checksum->string md) - (string-concatenate - (map (lambda (byte) - (format #f "~x~x" - (logand #xF (ash byte -4)) - (logand #xF byte))) - (bytevector->u8-list md)))) +(define* (checksum->string md #:optional port) + ((@ (ice-9 format) format) port + "~{~2'0x~}" (bytevector->u8-list md))) -- cgit v1.2.3