diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-03-03 02:32:04 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-03-07 22:00:16 +0100 |
commit | 7dea1c7799b7d57f56bad3f81389d8a150220c82 (patch) | |
tree | ae8528e6480123cfde46dba4557ad016c04a5396 /module/crypto.scm | |
parent | Add tests for (crypto) module. (diff) | |
download | calp-7dea1c7799b7d57f56bad3f81389d8a150220c82.tar.gz calp-7dea1c7799b7d57f56bad3f81389d8a150220c82.tar.xz |
Rewrote checksum->string.
Lets take full advantage of guile's format.
Diffstat (limited to 'module/crypto.scm')
-rw-r--r-- | module/crypto.scm | 10 |
1 files changed, 3 insertions, 7 deletions
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))) |