diff --git a/Code/Codecs/codecs.lisp b/Code/Codecs/codecs.lisp index 275d0b9ebcdb22f5335845f3bfc98cca4e4999a9..7263b23d402f1b5769c657f0b254c7e8c92c1426 100644 --- a/Code/Codecs/codecs.lisp +++ b/Code/Codecs/codecs.lisp @@ -40,14 +40,20 @@ :external-format *encoding*))) (define-codec base64-data - #'bytes->base64 #'base64->bytes) + #'bytes->base64 + (lambda (string) + (let* ((bytes* (base64->bytes string)) + (length (length bytes*))) + (coerce (subseq bytes* 0 length) '(vector (unsigned-byte 8)))))) (define-codec ref (lambda (reference) (check-type reference reference) (bytes->base64 (reference-hash reference))) (lambda (string) - (make-instance 'reference :hash (base64->bytes string)))) + (make-instance 'reference + :hash (coerce (subseq (base64->bytes string) 0 32) + '(vector (unsigned-byte 8)))))) (defun find-codec (name type) (let ((codec-definition (gethash name *codecs*))) diff --git a/Code/Crypto/hash.lisp b/Code/Crypto/hash.lisp index 0956bda529db7c3f8fcacdfe025b4d1bb99e94bc..cc5509750da2dc176374161de251e251f5d33659 100644 --- a/Code/Crypto/hash.lisp +++ b/Code/Crypto/hash.lisp @@ -9,8 +9,12 @@ '(vector (unsigned-byte 8))))) (defun base-hash-object (object &key (emit-signatures t)) - (hash-bytes (binary-render-object object :emit-signatures emit-signatures - :emit-computed-values nil))) + (let ((digest (make-digest :sha256))) + (binary-render-object object :emit-signatures emit-signatures + :emit-computed-values nil + :function (lambda (vector) + (update-digest digest vector))) + (produce-digest digest))) (defgeneric hash-object (object) (:documentation "Generate a hash for an object, including its signatures but not computed values.") diff --git a/Code/Scripts/Script-machine/assemble.lisp b/Code/Scripts/Script-machine/assemble.lisp index bf96d0ad704f75d9f1816a193ac549b6a655722c..670e66762a0442cfc44ef10bcf9ba14be6554aae 100644 --- a/Code/Scripts/Script-machine/assemble.lisp +++ b/Code/Scripts/Script-machine/assemble.lisp @@ -29,4 +29,4 @@ (coerce (loop for instruction in code append (assemble-instruction instruction)) - 'vector)) + '(vector (unsigned-byte 8))))