function MakeOTP(ALength: integer; ACharTypes: string): string;


This function generates a One-Time Password (OTP) of the desired length and including the desired character types.

 

Parameters

ALength

The length of the OTP to be generated

ACharTypes

A string which characters tells the function what character types must be included in the generation process:

  • n = include numbers
  • l = include lowercase alphabetic characters
  • u = include uppercase alphabetic characters
  • s = include special characters

 

Return value

AnsiString

This function returns an AnsiString containing the generated One-Time Password


Example


// The following example genertes a One-Time Password which is 8 characters long,
// containing numbers, lowercase characters and special characters, but NO uppercase
// characters
var
  MyOTP: string;
begin
  MyOTP := MakeOTP(8, 'nls');
  // MyOTP will contain something like this: ur6*k$2s
end.