Token Generation (token_gen.nvgt)
Token generation include
Allows you to easily generate random strings of characters of any length in a given mode.
Enums
token_gen_flag
This enum holds various constants that can be passed to the mode parameter in order to change how tokens are generated.
- token_gen_flag_all: Uses all characters, numbers and symbols, see below.
- token_gen_flag_characters: Uses only characters, a-z, A-Z
- token_gen_flag_numbers: Uses only numbers, 0-9
- token_gen_flag_symbols: Uses only symbols, `~!@#$%^&*()_+=-[]{}/.,;:|?><\
- token_gen_flag_numbers_symbols: Uses numbers and symbols.
- token_gen_flag_characters_symbols: Uses characters and symbols.
Functions
generate_token
Generates a string of random characters, or token.
string generate_token(int token_length, int mode = token_gen_flag_all)
Arguments:
int token_length: the length of the token to generate.
int mode = token_gen_flag_all: the mode to generate.
returns:
String: a random token depending on the mode.
Remarks:
The characters used to generate the token will depend on the mode you set. See token_gen_flags
enum constants.
Example:
#include "token_gen.nvgt"
void main() {
alert("Info", "Your token is: " + generate_token(10));
alert("Info", "Numbers only token is: " + generate_token(10, token_gen_flag_numbers));
alert("Info", "Characters only token is: " + generate_token(10, token_gen_flag_characters));
}