aboutsummaryrefslogtreecommitdiff
path: root/module/crypto.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-08-09 23:35:20 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-08-15 19:44:59 +0200
commitce42ed14891014e8be344fde7e3e25a2b26c150a (patch)
tree51a664c0d9644c34d0dfa21b9796edd8a8a5b4da /module/crypto.scm
parentFix paginator buttons forgetting future clause. (diff)
downloadcalp-ce42ed14891014e8be344fde7e3e25a2b26c150a.tar.gz
calp-ce42ed14891014e8be344fde7e3e25a2b26c150a.tar.xz
Render attachements to HTML frontend.
Diffstat (limited to 'module/crypto.scm')
-rw-r--r--module/crypto.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/module/crypto.scm b/module/crypto.scm
index 0b18f240..3e468018 100644
--- a/module/crypto.scm
+++ b/module/crypto.scm
@@ -18,7 +18,10 @@
(define (sha256 msg)
(define md (make-bytevector SHA256_DIGEST_LENGTH))
- (define bv (string->utf8 msg))
+ (define bv
+ (cond ((bytevector? msg) msg)
+ ((string? msg) (string->utf8 msg))
+ (else (throw 'value-error "Invalid type"))))
(SHA256 ((@ (system foreign) bytevector->pointer) bv)
(bytevector-length bv)
((@ (system foreign) bytevector->pointer) md))