<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !STR.- String Command > String Operations |
MiniRobotLanguage (MRL)
STR.GENERATE RANDOM
String commands
Intention
GENERATE RANDOM STRING - Mode: This Mode will generate a random String of specified length and from specified characters. You can use it to generate passwords.
The sequence lenght is about 2^32 for this PRNG.
For true cryptpgraphical random numbers and "One Time Pads" use other options, for example the CHAR D - Option.
The command itself looks like this:
STR.GENERATE|$$SRC|$$CNT|$$CHR
And here is a small example:
: $$TXT=ABC
: $$NUM=5
STR.GENERATE|$$SRC|$$NUM|$$TXT
MBX.$$SRC
STR.GENERATE|$$SRC
MBX.$$SRC
ENR.
Which will bring up a Message-Box like this ..
Pic.1 Result from:
STR.GENERATE|$$SRC|$$NUM|$$TXT
and a Message-Box like this:
Pic.2 Result from:
STR.GENERATE|$$SRC
Syntax
STR.GENERATE|P1[|P2][|P3]
Parameter Explanation
P1 - source and destination variable
P2 - (optional) length of desired random string in bytes. If omitted, a default length of 32 byte length is used.
P3 - (optional) variable with all characters that should be used for the random string generation.
Alternatively you can use some small letters to define the character-Set for P3.
- empty/if P3 is omitted, then the whole charset from 255 ASC-Characters will be used.
"a" - all ASC-Character (0-255)
"b" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-?#+*"
"c" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-?"
"d" - "abcdefghijklmnopqrstuvwxyzöüäßABCDEFGHIJKLMNOPQRSTUVWXYZÄÜÖ"
"e" - "abcdefghijklmnopqrstuvwxyz"
"f" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"g" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@|<>.1234567890_\-;:*+#§%&/()=! "
"h" - "0123456789ABCDEF"
"i" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'´`[]{}@.1234567890_-;+#§%&()=! "
"k" - ":\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@.1234567890_-;+#§%&()=! "
"m" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890_\ "
"o" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
"n" - "0123456789"
"p" - "\/:*?<>|"+ASC(34) (Double-Quotes)
"x" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß[]{}@<>.1234567890_\-;:*+#§%&/()=!"
Example
'*************************************
' STR.GENERATE
'*************************************
: $$TXT=ABC
: $$NUM=5
STR.GENERATE|$$SRC|$$NUM|$$TXT
MBX.$$SRC
STR.GENERATE|$$SRC
MBX.$$SRC
ENR.
Remarks
There is no warranty whatever, that these randomly generated strings are safe for use with cryptographic or safety software, or even for passwords. Use them on your own risk.
Limitations:
-
See also:
• 1.5.2 Working with Text-Strings
• VAR. - Variable Set Value/Clear
• IVS. / NVS. - If-Variable-String
• SBD. - String between Delimiter
• SBM. - String between Delimiter-Multiple