anchor.diff:    (base64-encoder state output input output-start output-end
                     input-start input-end lastp #'identity))
   
  -(defun string->octets/base64 ()
  -  )
  -
  -(defun octets->octets/decode/base64 ()
  -  )
  -
   (defun encoded-length/base64 (count)
     "Return the number of characters required to encode COUNT octets in Base64."
     (* (ceiling count 3) 4))
  
positive.code: 
  (register-descriptor-and-constructors :base64 (base64-format-descriptor)
                                        #'make-base64-encode-state
                                        #'make-base64-encode-state)
  (register-descriptor-and-constructors :base64url (base64-format-descriptor)
                                        #'make-base64url-encode-state
                                        #'make-base64url-encode-state)
  
negative.code: (defvar *base64url-decode-table*
    (make-decode-table *base64url-encode-table*))
  (declaim (type decode-table *base64url-decode-table*))
  
  (defstruct (base64-decode-state
               (:include decode-state)
               (:copier nil)
               (:constructor %make-base64-decode-state
                             (table
                              &aux (descriptor (base64-format-descriptor)))))
    (bits 0 :type (unsigned-byte 16))
    (n-bits 0 :type (unsigned-byte 8))
    (padding-remaining 0 :type (integer 0 3))
    (table *base64-decode-table* :read-only t :type decode-table))
  
  (defun make-base64-decode-state (case-fold map01)
    (declare (ignore case-fold map01))
    (%make-base64-decode-state *base64-decode-table*))
  
  (defun make-base64url-decode-state (case-fold map01)
    (declare (ignore case-fold map01))
    (%make-base64-decode-state *base64url-decode-table*))
  
  (defun base64-decoder (state output input
                         output-index output-end
                         input-index input-end lastp converter)
    (declare (type base64-decode-state state))
    (declare (type simple-octet-vector output))
    (declare (type index output-index output-end input-index input-end))
    (declare (type function converter))
    (let ((bits (base64-decode-state-bits state))
          (n-bits (base64-decode-state-n-bits state))
          (padding-remaining (base64-decode-state-padding-remaining state))
          (table (base64-decode-state-table state)))
      (declare (type (unsigned-byte 16) bits))
      (declare (type fixnum n-bits))
      (declare (type (integer 0 6) padding-remaining))
      (tagbody
       PAD-CHECK
         (when (base64-decode-state-finished-input-p state)
           (go EAT-EQUAL-CHECK-PAD))
       OUTPUT-AVAILABLE-CHECK
         (when (< n-bits 8)
           (go INPUT-AVAILABLE-CHECK))
       OUTPUT-SPACE-CHECK
         (when (>= output-index output-end)
           (go DONE))
       DO-OUTPUT
         (decf n-bits 8)
         (setf (aref output output-index) (logand (ash bits (- n-bits)) #xff)
               bits (logand bits #xff))
         (incf output-index)
         (go INPUT-AVAILABLE-CHECK)
       INPUT-AVAILABLE-CHECK
         (when (>= input-index input-end)
           (go DONE))
       DO-INPUT
         (let* ((c (aref input input-index))
                (v (funcall converter c))
                (d (dtref table v)))
           (when (= v (funcall converter #\=))
             (go SAW-EQUAL))
           (when (= d +dt-invalid+)
             (error "invalid base64 character ~A at position ~D" c input-index))
           (incf input-index)
           (setf bits (ldb (byte 16 0) (logior (ash bits 6) d)))
           (incf n-bits 6)
           (go OUTPUT-AVAILABLE-CHECK))
       DONE
         (unless lastp
           (go RESTORE-STATE))
       SAW-EQUAL
         (setf (base64-decode-state-finished-input-p state) t)
         (cond
           ((zerop n-bits)
            (go RESTORE-STATE))
           ((= n-bits 2)
            (setf padding-remaining 3))
           ((= n-bits 4)
            (setf padding-remaining 2)))
       EAT-EQUAL-CHECK-PAD
         (when (zerop padding-remaining)
           (go RESTORE-STATE))
       EAT-EQUAL-CHECK-INPUT
         (when (>= input-index input-end)
           (go RESTORE-STATE))
       EAT-EQUAL
         (let ((v (aref input input-index)))
           (unless (= (funcall converter v) (funcall converter #\=))
             (error "invalid base64 input ~A at position ~D" v input-index))
           (incf input-index)
           (decf padding-remaining)
           (go EAT-EQUAL-CHECK-PAD))
       RESTORE-STATE
         (setf (base64-decode-state-n-bits state) n-bits
               (base64-decode-state-bits state) bits
               (base64-decode-state-padding-remaining state) padding-remaining))
      (values input-index output-index)))
  
  (defun string->octets/base64 (state output input
                                output-index output-end
                                input-index input-end lastp)
    (declare (type simple-string input))
    (base64-decoder state output input output-index output-end
                    input-index input-end lastp #'char-code))
  
  (defun octets->octets/decode/base64 (state output input
                                       output-index output-end
                                       input-index input-end lastp)
    (declare (type simple-octet-vector input))
    (base64-decoder state output input output-index output-end
                    input-index input-end lastp #'identity))
  
  (defun decode-octets-base64 (string start end length table writer)
    (declare (type index start end))
  