buddy.core.nonce

Namespace dedicated to provide an abstraction for generate a valid secure nonce values.

By convenience, it also exposes additional functions for generate random iv/salts.

for-engine

multimethod

random-bytes

(random-bytes numbytes)(random-bytes numbytes sr)

Generate a byte array of scpecified length with random bytes taken from secure random number generator. This method should be used to generate a random iv/salt or arbitrary length.

random-nonce

(random-nonce numbytes)(random-nonce numbytes sr)

Generate a secure nonce based on current time and additional random data obtained from secure random generator. The minimum value is 8 bytes, and recommended minimum value is 32.