Last active
December 26, 2015 14:28
-
-
Save iamjono/7165512 to your computer and use it in GitHub Desktop.
PWD gen trait
derivative of xs_genPwd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/* ========================================================== | |
PWD gen trait | |
derivative of xs_genPwd | |
Usage once imported into Lasso 9 type: | |
.genPwd => 8 char random pwd | |
.genPwd(16) => 16 char random pwd | |
.genPwdAlpha => 8 char random not incl punctuation chars | |
========================================================== */ | |
define std_pwd => trait { | |
provide genPwd(size::integer=8) => { | |
local(pMap = array('!','$','%','&','*','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Y','Z','a','1','2','3','4','5','6','7','8','9','0')) | |
local(thisPwd = string) | |
loop(#size) => { | |
#thisPwd->append(#pMap->get(integer_random(#pMap->size,1))) | |
} | |
return #thisPwd | |
} | |
provide genPwdAlpha(size::integer=8) => { | |
local(pMap = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Y','Z','a','1','2','3','4','5','6','7','8','9','0')) | |
local(thisPwd = string) | |
loop(#size) => { | |
#thisPwd->append(#pMap->get(integer_random(#pMap->size,1))) | |
} | |
return #thisPwd | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment