        out
        (bb/->indirect-byte-buf ctext)
        (bb/->indirect-byte-buf st/secret-key))
-      (is (u/array-eq st/ptext out)))
+      (is (bb/bytes= st/ptext out)))
 
     (let [out (bb/alloc ptextlen)
           forgery (bb/->indirect-byte-buf (r/randombytes (bb/buflen out)))]

         xord-ctexts (byte-array shortest)]
     (apply #'ms/xor! xord-ptexts ptexts)
     (apply #'ms/xor! xord-ctexts ctexts)
     (u/array-eq xord-ptexts xord-ctexts))))

(deftest secretbox-pfx-test
  (let [nonce (byte-array (range s/noncebytes))


  (let [c1 (ms/secretbox-rnd st/ptext st/secret-key)
        c2 (ms/secretbox-rnd st/ptext st/secret-key)]
    (is (not (bb/bytes= c1 c2)))
    (is (not= (take s/noncebytes c1) (take s/noncebytes c2))))

  (with-redefs [ms/random-nonce! constant-nonce]
    (let [c1 (ms/secretbox-rnd st/ptext st/secret-key)
          c2 (ms/secretbox-rnd st/ptext st/secret-key)]
      (is (bb/bytes= c1 c2))
      (is (= (range s/noncebytes) (take s/noncebytes c1) (take s/noncebytes c2))))))

(deftest synthetic-nonce-test
