Liking cljdoc? Tell your friends :D

strojure.web-security.util.random


random-string-fnclj

(random-string-fn encode size)

Returns 0-arity function to generate random byte array of size bytes encoded with function encode. Uses instance of SecureRandom to generate random data.

Returns 0-arity function to generate random byte array of `size` bytes
encoded with function `encode`. Uses instance of `SecureRandom` to generate
random data.
sourceraw docstring

url-safe-string-fnclj

(url-safe-string-fn size)

Returns 0-arity function to generate random byte array of size bytes which is URL encoded without padding (16 bytes produce 22-char string). Uses random-string-fn with [[util.base64/url-encode-no-padding]] as encode-fn.

Example:

(def url-safe-string (url-safe-string-fn 16))

(url-safe-string)
:=> "CAAuS3CWaMZqh490vfoFWA"
;             Execution time mean : 1.134222 µs
;    Execution time std-deviation : 141.224567 ns
;   Execution time lower quantile : 1.060196 µs ( 2.5%)
;   Execution time upper quantile : 1.378707 µs (97.5%)
Returns 0-arity function to generate random byte array of `size` bytes which
is URL encoded without padding (16 bytes produce 22-char string). Uses
[[random-string-fn]] with [[util.base64/url-encode-no-padding]] as `encode-fn`.

Example:

    (def url-safe-string (url-safe-string-fn 16))

    (url-safe-string)
    :=> "CAAuS3CWaMZqh490vfoFWA"
    ;             Execution time mean : 1.134222 µs
    ;    Execution time std-deviation : 141.224567 ns
    ;   Execution time lower quantile : 1.060196 µs ( 2.5%)
    ;   Execution time upper quantile : 1.378707 µs (97.5%)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close