Skip to content

libsodium.RandomBytes

Andrew Lambert edited this page Nov 26, 2022 · 7 revisions

libsodium.RandomBytes

Method Signature

 Protected Function RandomBytes(Count As UInt32, Optional Seed As MemoryBlock) As MemoryBlock

Parameters

Name Type Comment
Count UInt32 The number of unpredictable bytes to generate.
Seed MemoryBlock Optional. The data to seed the PRNG with. (See remarks)

Return value

A MemoryBlock containing exactly Count unpredictable bytes, or Nil on error.

Remarks

Generates a MemoryBlock filled with the requested number of unpredictable bytes. Data returned from this function is suitable for use as a random key, nonce, or salt.

If the optional Seed value is specified then this operation is deterministic. The Seed must be exactly randombytes_SEEDBYTES(32) bytes long.

See also

Clone this wiki locally