Skip to content

Commit

Permalink
The GSM package [ver. 0.19]
Browse files Browse the repository at this point in the history
The `GSM` package [ver. 0.19]

- The code file parsing modified.
- A `lineEnd=` parameter added.
- The `trim=` parameter deprecated.
- A warning about the `/*%` text changed into a note.
- Documentation updated.

hash: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF
  • Loading branch information
yabwon committed Mar 13, 2022
1 parent 76c7793 commit df04e48
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ SHA256 digest for BasePlus: A60A300E083628C65DD6899E7EF95588916F8F66B6A25B32B322

[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")

- **GSM** (Generate Secure Macros)\[0.18\], package allows
- **GSM** (Generate Secure Macros)\[0.19\], package allows
to create secured macros stored in SAS Proc FCMP functions.
The dataset with functions can be shared between different operating systems
and allows to generate macros on site without showing their code.

SHA256 digest for GSM: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D
SHA256 digest for GSM: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF

[Documentation for GSM](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md "Documentation for GSM")

Expand Down
4 changes: 2 additions & 2 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ SHA256 digest for BasePlus: A60A300E083628C65DD6899E7EF95588916F8F66B6A25B32B322

---

- **GSM** (Generate Secure Macros)\[0.18\], package allows
- **GSM** (Generate Secure Macros)\[0.19\], package allows
to create secured macros stored in SAS Proc FCMP functions.
The dataset with functions can be shared between different operating systems
and allows to generate macros on site without showing their code.

SHA256 digest for GSM: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D
SHA256 digest for GSM: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF

[Documentation for GSM](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md "Documentation for GSM")

Expand Down
3 changes: 3 additions & 0 deletions packages/SHA256_for_packages.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* 20220307 */
GSM: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF

/* 20220307 */
GSM: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D

Expand Down
73 changes: 57 additions & 16 deletions packages/gsm.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
---


# The GSM package [ver. 0.18] <a name="gsm-package"></a> ###############################################
# The GSM package [ver. 0.19] <a name="gsm-package"></a> ###############################################

The **GSM** (a.k.a. *Generate Secure Macros*) package allows
to create secured macros stored in SAS Proc FCMP functions.
Expand Down Expand Up @@ -54,8 +54,33 @@ Recording of presentation with "how it works" description, in Polish, is avaliab
```
- Share generated `ZIP` file (unzip and run the code).

*Limitations:*
Single macro file cannot be longer than 32760 bytes.
**Limitations:**
- Single macro file cannot be longer than 32760 bytes.

- Multiline text variable. Consider the following code text file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%macro~test()/SECURE;~#@
data~test;~#@
a~=~"abc~#@
~#@
def";~#@
put~a~hex20.;~#@
run;~#@
%mend~test;~#@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where `~` symbols the space character,
`#` symbols the carriage return (`0D`),
and `@` symbols the line feed (`0A`).
The code file is scanned and inserted into
the `resolve()` function argument in a "byte by byte"
fashion hence also the "end of line" characters are included.
As the result value of variable `a` will be:

`a = "abc~#@~#@def"`.

If you want to use the `GSM` package avoid
such "style" of coding in your macros.


---

Expand All @@ -69,7 +94,7 @@ Required SAS Components:
* SAS package generated by generatePackage, version 20220113 *

The SHA256 hash digest for package GSM:
`8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D`
`F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF`


## >>> `%GSM()` macro: <<< <a name="gsm-macro"></a> #######################
Expand All @@ -92,7 +117,7 @@ be added to the macro definition. See the example:


As a result a zip file, containing dataset with functions and
code to be executed on site, is generated.
code to be executed on site, is generated.

Since encrypted code is stored in a SAS dataset it has
no limitation in sharing between operating systems (like catalogs have).
Expand All @@ -117,6 +142,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,outpath=>
<,encodingRestricted=>
<,secret=>
<,lineEnd=>
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -125,10 +151,6 @@ The basic syntax is the following, the `<...>` means optional parameters:
1. `path` - *Required*, indicates a directory which contains files with macros.
Only files with `sas` extension are used.

* `trim=` - *Optional*, the default value is `0`.
If set to `1` then lines of macro code are trimmed.
If set to `2` then lines of macro code are stripped.

* `cmplib=` - *Optional*, the default value is `work.generateMacros`.
Names the dataset which will contain generated functions.

Expand All @@ -151,8 +173,20 @@ The basic syntax is the following, the `<...>` means optional parameters:
Required to execute the `resolve()` function.
User who do not know the value will not be able
to run the `_maxro_XX_()` function.
---

* `lineEnd=` - *Optional*, the default value is `0D0A`, indicates which of:
line feed, carriage return, or both, or a space be inserted
at the end of line in the intermediate code file that is generated.
Value has to be hexadecimal code (_NOT_ null),
since the value is resolved as `"&lineEnd."x`, so use e.g.
`0A` for line feed, `0D` for carriage return,
`0D0A` for both, and `20` for space.

* `trim=` - *Deprecated*, the default value is `0`.
*Kept for backward compatibility.*


---

### Example: ###################################################################

Expand Down Expand Up @@ -197,8 +231,7 @@ run;
%GSM(&path., cmplib=work.myMacros)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


## >>> `%GSMpck_makeFCMPcode()` macro: <<< <a name="gsmpck-makefcmpcode-macro"></a> #######################
## >>> `%GSMpck_makeFCMPcode()` macro: <<< <a name="GSMpck-makeFCMPcode-macro"></a> #######################

The `%GSMpck_makeFCMPcode()` macro is an internal macro of
the **GSM** (a.k.a. *Generate Secure Macros*) package.
Expand All @@ -219,11 +252,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
%GSMpck_makeFCMPcode(
path
,number
<,trim=0>
<,outlib=work.generateMacros.secure>
<,source2=>
<,fileNameCode=FNC>
<,secret=123456789>
<,lineEnd=0A>
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -234,9 +267,6 @@ The basic syntax is the following, the `<...>` means optional parameters:

2. `number` - *Required*, a sequential number.

* `trim=` - *Optional*, the default value is `0`.
If set to `1` then lines of macro code are trimmed.
If set to `2` then lines of macro code are stripped.

* `cmplib=` - *Optional*, the default value is `work.generateMacros`.
Names the dataset which will contain generated functions.
Expand All @@ -253,6 +283,17 @@ The basic syntax is the following, the `<...>` means optional parameters:
function. User who do not know the value will not be able
to run the `_maxro_XX_()` function.

* `lineEnd=` - *Optional*, the default value is `0D0A`, indicates which of:
line feed, carriage return, or both, or a space be inserted
at the end of line in the intermediate code file that is generated.
Value has to be hexadecimal code (_NOT_ null),
since the value is resolved as `"&lineEnd."x`, so use e.g.
`0A` for line feed, `0D` for carriage return,
`0D0A` for both, and `20` for space.

* `trim=` - *Deprecated*, the default value is `0`.
*Kept for backward compatibility.*

---


Expand Down
Binary file modified packages/gsm.zip
Binary file not shown.

0 comments on commit df04e48

Please sign in to comment.