FreeRADIUS InkBridge

%str.rand( <format> )

Get random string built from input character classes.

Return: string

Build strings of random chars, useful for generating tokens and passcodes Format similar to the Perl module String::Random.

Format characters may include the following, and may be preceded by an integer repetition count:

Table 1. Character Classes
Character Description

c

lowercase letters [a-z]

C

uppercase letters [A-Z]

n

numbers [0-9]

a

alphanumeric

!

punctuation !"#$%&'()*+,-./:;<⇒?@[\\]^_{|}~`

.

alphanumeric + punctuation

s

alphanumeric + . and /

o

characters suitable for OTP (visually similar characters removed)

b

binary data

There is no h for "hex". Instead, use b to create binary data, and then use the %hex(..) function to convert the output to hex.

Example of a random string
reply.Reply-Message := "The random string output is %str.rand('8a')"
Output
The random string output is 4Uq0gPyG
Example of conversion to hex
reply.Reply-Message := "The random string output is %hex(%str.rand('1b'))"
Output
The random string output is ad