Skip to content

Commit 1e6f189

Browse files
authored
Fix program spacing
Signed-off-by: Stacey Syphus <[email protected]>
1 parent a37ded6 commit 1e6f189

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

By Topic/Utility Macros/Random Password Generator.sas

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
RANDOM PASSWORD GENERATION
33
A macro program that generates a random password based on a list of allowed characters.
44
Keywords: Macro
5-
SAS Versions: SAS 9, SAS Viya
5+
SAS Versions: SAS 9, SAS Viya
66
Documentation: https://go.documentation.sas.com/doc/en/pgmsascdc/default/mcrolref/titlepage.htm
77
1. Define keyword arguments control the length and characters used in the password.
88
2. Build a macro variable containing all allowed characters.
99
3. In a loop, use %SUBSTR(%SYSFUNC(RAND)) to select random characters...
1010
4. ...and append them to the growing password.
1111
5. Test macro via a simple loop and various settings.
1212
6. Use a random password for an encryption key on a tempoarary dataset.
13-
NOTE: Does not (currently) support unmatched single or double quote characters
14-
in the special characterw string. Mismatched left or right parentheses have not been
15-
tested either.
13+
NOTE: Does not (currently) support unmatched single or double quote characters in the special
14+
characterw string. Mismatched left or right parentheses have not been tested either.
1615
************************************************************************************************/
1716

1817
/************************************************************************************************
1918
1. Define keyword arguments control the length and characters
2019
used in the password.
2120
a. len= is the desired length of the password, defaulting to 24
22-
b. digits= is a Boolean flag, defaulting to TRUE. When TRUE (non-zero),
23-
digits 0-9 are available for use in the password.
24-
c. special= is a set of special characters to also use in passwords. Defaults
25-
to those shown in the %NRSTR(). Use special= to not have any specials.
21+
b. digits= is a Boolean flag, defaulting to TRUE. When TRUE (non-zero),
22+
digits 0-9 are available for use in the password.
23+
c. special= is a set of special characters to also use in passwords. Defaults
24+
to those shown in the %NRSTR(). Use special= to not have any specials.
2625
************************************************************************************************/
2726

2827
%MACRO RANDPASS(len=24,digits=1,special=%NRSTR(@%&#!?.-_+*,/;:));
@@ -35,10 +34,10 @@
3534
/************************************************************************************************
3635
2. Build a macro variable containing all allowed characters.
3736
a. Add the lowercase letters.
38-
b. Add uppercase characters via %UPCASE().
39-
c. Add digits, if requested.
40-
d. Add special characters. Note the use of %SUPERQ() to avoid issues
41-
with &s and %s that may be present in the string.
37+
b. Add uppercase characters via %UPCASE().
38+
c. Add digits, if requested.
39+
d. Add special characters. Note the use of %SUPERQ() to avoid issues
40+
with &s and %s that may be present in the string.
4241
************************************************************************************************/
4342

4443
%LET chars=abcdefghijklmnopqrstuvwxyz;
@@ -88,10 +87,10 @@
8887
/************************************************************************************************
8988
5. Test macro via a simple loop and various settings.
9089
a. We need to define a macro for this. Macro now allows %IF statements in
91-
"open code", but not loops.
92-
b. Just two cases here. All-defaults, plus longer-no-digits-no-specials.
93-
c. The "test" just prints them to the log, for eyeballing.
94-
d. Then we run the loop 3 times to get an idea as to what it's doing.
90+
"open code", but not loops.
91+
b. Just two cases here. All-defaults, plus longer-no-digits-no-specials.
92+
c. The "test" just prints them to the log, for eyeballing.
93+
d. Then we run the loop 3 times to get an idea as to what it's doing.
9594
************************************************************************************************/
9695

9796
%MACRO TEST(n);
@@ -106,13 +105,13 @@
106105
/************************************************************************************************
107106
6. Use a random password for an encryption key on a tempoarary dataset.
108107
a. Generate a longish (60 characters) password, safe from prying eyes.
109-
b. Import a list of NSA recruits from a secret location no one has
110-
ever heard of, and protect it with AES encryption with our generated
111-
password.
112-
c. Now we can run analytics on it safely. Run PROC MEANS, and
113-
then ponder why the recruits are all teenagers.
114-
d. Drop the table (I used PROC SQL), knowing that even if the
115-
data was recovered from the disk, the encryption renders it unreadable.
108+
b. Import a list of NSA recruits from a secret location no one has
109+
ever heard of, and protect it with AES encryption with our generated
110+
password.
111+
c. Now we can run analytics on it safely. Run PROC MEANS, and
112+
then ponder why the recruits are all teenagers.
113+
d. Drop the table (I used PROC SQL), knowing that even if the
114+
data was recovered from the disk, the encryption renders it unreadable.
116115
************************************************************************************************/
117116

118117
%LET pw=%randpass(len=60);

0 commit comments

Comments
 (0)