   "Bindings to the secretbox secret-key authenticated encryption scheme."
   (:require [caesium.binding :as b]
             [caesium.util :as u]
-            [caesium.byte-bufs :refer [buflen]])
+            [caesium.byte-bufs :as bb])
   (:import [java.nio ByteBuffer]))
 
 (b/defconsts [keybytes noncebytes macbytes primitive])

  automatically prepend the required `BOXZERO_BYTES` NUL bytes, verify
  that the decryption succeeded, and strip them from the returned
  plaintext."
  [ctext nonce key]
  (let [out (byte-array (- (buflen ctext) macbytes))]
    (secretbox-open-easy-to-buf! out ctext nonce key)))

(defn encrypt
  "Backwards-compatible alias for [[secretbox-easy]].

  Please note that this uses a different argument order."
  [key nonce msg]
  (secretbox-easy msg nonce key))

(defn decrypt
  "Backwards-compatible alias for [[secretbox-open-easy]].

  Please note that this uses a different argument order."
  [key nonce ciphertext]
  (secretbox-open-easy ciphertext nonce key))

(def int->nonce
  "Turns an integer into a byte array, suitable as a nonce.

  You only want this to manage the output byte buffer yourself. Otherwise,
  you want [[secretbox-easy]]."
  [c m n k]
  (b/✨ easy c m n k))

(defn secretbox-easy
  "Encrypt with `crypto_secretbox_easy`.
