Back

fill! (clj)

(source)

function

(fill! input val) (fill! input val & {:keys [limit offset start end]})
Assigns the specified byte value to each element of the specified array of bytes.

Examples

funcool/buddy-core
(ns buddy.core.padding-tests
  (:require [clojure.test :refer :all]
            [buddy.core.codecs :as codecs]
            [buddy.core.bytes :as bytes]
            [buddy.core.padding :as padding]))

(deftest pkcs7-padding
  (let [data (byte-array 10)]
    (bytes/fill! data 2)
    (padding/pad! data 6)

(deftest tbc-padding
  (let [data (byte-array 10)]
    (bytes/fill! data 2)
    (padding/pad! data 6 :tbc)

(deftest zerobyte-padding
  (let [data (byte-array 10)]
    (bytes/fill! data 2)
    (padding/pad! data 6 :zerobyte)