Brian Dunning's FileMaker Custom Functions

GeneratePW ( Digit ; Option )

Generate random password string.

  Average rating: 4.5 (30 votes) Log in to vote

Koji Takeuchi   Koji Takeuchi - Show more from this author
TonicNote, Inc.
https://tonicnote.com

Share on Facebook Share on Twitter

  Sample input:
GeneratePW ( 8 ; "lusn" )
  Sample output:
"8Dfu7)e!"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

GeneratePW ( Digit ; Option )
2013.10.29, Koji Takeuchi

description:
Generate random password string.
Params:
Digit Length of the Password string you are about to generate.
Option l Use lower case (ex. abcd)
u Use upper case (ex. ABCD)
s Use symbol (ex. $!%)
n Use numeral string (ex. 12345)
Default is "lusn".
Example:
GeneratePW ( 8 ; "lusn" )
-> "8Dfu7)e!"
GeneratePW ( 8 ; "lus" )
-> "Uw*f&%S"
GeneratePW ( 8 ; "l" )
-> "kwpdowgu"

GeneratePW ( 8 ; "" ) = GeneratePW ( 8 ; "lusn" )
GeneratePW ( "" ; "?" ) will show this help.

 

Comments

Agnès   Agnès, Paris
Oct 31, 2013
Hello,

Just for fun, you can put the possibility of its own chain and include or exclude duplicates
I allowed a different approach, not recursive, but with "false small recursive"

this would :
// GeneratePW ( Chaine ; Digit ; Option ; Dupli ) // Max Digit = 404
//-------------
Let ([

$Chaine = Case ( IsEmpty ( Chaine ) ;
Substitute (
"[-]" & Filter ( Option ; "lusn" ) ;
[ "[-]" ; Case ( IsEmpty ( Option ) ; "lusn" ; "" ) ] ; [ "l" ; "[l]" ] ; [ "u" ; "[u]" ] ; ["s" ; "[s]" ] ; ["n" ; "[n]" ] ;
[ "[l]" ; "abcdefghijkmnopqrstuvwxyz" ] ; [ "[u]" ; "ABCDEFGHJKLMNPQRTUVWXYZ" ] ; [ "[s]" ; "~!@#$%^&*()-<>" ] ; [ "[n]" ; "2346789" ] ) ; Chaine ) ;

Calc = "Let ( $n = Int ( Random * Length ( $Chaine ) ) + 1 ; Middle ( $Chaine ; $n ; 1 ) ) &" ;
NoDupli = Case ( Dupli = 0 ; "Let ( $Chaine = Replace ( $Chaine ; $n ; 1 ; """" ) ; """" ) &" )

] ;
Evaluate ( Substitute ( ( 10 ^ Digit ) - 1 ; 9 ; Calc & NoDupli ) & """""" )
)
//--------

for example with :
Chaine = "" ; // Empty or No
Option = "lusn" ; // Empty or char l u n s only
Digit = "10" ; // Length PW
Dupli = 1 // 1 for duplicate char or 0 for no duplicate char (Empty = Duplicate ok )

Best regards
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: