     (.putLong buffer length)
     (.array buffer)))
 
-;; +-------------------------------+-------------+-------------+-------+
-;; |           algorithm           | ENC_KEY_LEN | MAC_KEY_LEN | T_LEN |
-;; +-------------------------------+-------------+-------------+-------+
-;; | AEAD_AES_128_CBC_HMAC_SHA_256 |      16     |      16     |   16  |
-;; |                               |             |             |       |
-;; | AEAD_AES_192_CBC_HMAC_SHA_384 |      24     |      24     |   24  |
-;; |                               |             |             |       |
-;; | AEAD_AES_256_CBC_HMAC_SHA_512 |      32     |      32     |   32  |
-;; +-------------------------------+-------------+-------------+-------+
-
 (defn extract-encryption-key
   [secret algorithm]
   {:pre [(bytes/bytes? secret)]}

        encryptionkey (extract-encryption-key secret algorithm)
        authkey (extract-authentication-key secret algorithm)]
    (when-not (verify-authtag authtag (assoc params :authkey authkey :algorithm :sha384))
      (throw+ {:type :validation :cause :authtag :message "Message seems corrupted or manipulated."}))
    (decrypt cipher ciphertext encryptionkey iv)))

(defmethod aead-decrypt :a256cbc-hs512

        encryptionkey (extract-encryption-key secret algorithm)
        authkey (extract-authentication-key secret algorithm)]
    (when-not (verify-authtag authtag (assoc params :authkey authkey :algorithm :sha512))
      (throw+ {:type :validation :cause :authtag :message "Message seems corrupt or manipulated."}))
    (decrypt cipher ciphertext encryptionkey iv)))

(defn- generate-plaintext
