Commit fef764d7 authored by  Hayley Patton's avatar Hayley Patton 🐢

Ensure everything puts out simple arrays, pipe binary renderer directly to Ironclad

parent 545019d4
......@@ -40,14 +40,20 @@
:external-format *encoding*)))
(define-codec base64-data
#'bytes->base64 #'base64->bytes)
(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*)))
......@@ -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.")
......@@ -29,4 +29,4 @@
(loop for instruction in code
append (assemble-instruction instruction))
'(vector (unsigned-byte 8))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment