View Source Honu.SecureRandom (Honu v0.3.2)
Link to this section Summary
Functions
Returns random Base36 encoded string.
Returns random Base64 encoded string.
Generates a random hexadecimal string.
Returns random bytes.
Link to this section Functions
Returns random Base36 encoded string.
examples
Examples
iex> Honu.SecureRandom.base36
"7coz8ju9gue4liebt3481e5tg"
iex> Honu.SecureRandom.base36(8)
"kckitp81brv6"
Returns random Base64 encoded string.
examples
Examples
iex> Honu.SecureRandom.base64
"rm/JfqH8Y+Jd7m5SHTHJoA=="
iex> Honu.SecureRandom.base64(8)
"2yDtUyQ5Xws="
Generates a random hexadecimal string.
The argument n specifies the length, in bytes, of the random number to be generated. The length of the resulting hexadecimal string is twice n.
If n is not specified, 16 is assumed. It may be larger in future.
The result may contain 0-9 and a-f.
examples
Examples
iex> Honu.SecureRandom.hex(6)
"34fb5655a231"
Returns random bytes.
examples
Examples
iex> Honu.SecureRandom.random_bytes
<<202, 104, 227, 197, 25, 7, 132, 73, 92, 186, 242, 13, 170, 115, 135, 7>>
iex> Honu.SecureRandom.random_bytes(8)
<<231, 123, 252, 174, 156, 112, 15, 29>>