From ce42ed14891014e8be344fde7e3e25a2b26c150a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 9 Aug 2021 23:35:20 +0200 Subject: Render attachements to HTML frontend. --- module/crypto.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/crypto.scm') 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)) -- cgit v1.2.3