316 views
in GUI Development by
Hi Team,

I want to create auto generated passwords for users with the length of six. It should contain minimum of one upper case, one lower case and one number. Does embedded wizard supports any instant methods to achieve this functionality?. If not how can we generate these kind of strings?

Regards,

Sazna.

1 Answer

0 votes
by

Hello Sazna,

Does embedded wizard supports any instant methods to achieve this functionality?

You will need to implement own routine to compose the password from random characters. If your application does not have high security requirements, you could use the pseudo random number generator function math_rand(). The following example demonstrates how to get a string of random characters A..Z. Based on this idea you can add more character ranges (digits, special characters, etc.):

// Desired number of signs in the resulting string
var int32  count = 8;
var string s;

// Compose the string of random characters
while ( count-- > 0 )
  s += char( math_rand( int32( 'A' ), int32( 'Z' )));

// 's' contains the random string
trace s;

In case of special characters, prepare a string containing the special characters and select the characters from the string using a random index:

var string specialChars = "!ยง%&/()*+#'-_.:,;";

// Desired number of signs in the resulting string
var int32  count = 8;
var string s;

// Compose the string of random characters
while ( count-- > 0 )
  s += specialChars[ math_rand( 0, specialChars.length - 1 )];

// 's' contains the random string
trace s;

I hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...