| File name: Encrypt.pql | Creator: David Merle | Created: 10/16/2007 | Called by: Any program that wants to call it | Reason: Encrypts any string and returns the coded version. If used on an encrypted string, it returns the | unencrypted string. | Output: An encrypted or unencrypted string subroutine UTIL.ENCRYPT (IN$) returning (CODED$) replace nodatabase . integer * 2 ASCII | Store the ASCII value of a character . ASCII = 0 . string * 300 IN$ | Input string (to be coded) . string * 300 CODED$ | Coded string . set CODED$ ('') . for x = 1, len(IN$) | For the length of the input string . ASCII = ichar(sbst(IN$, x, 1)) | Convert each character into its ASCII value . ifthen (amod(x,4) = 0) | For every 4th character . ifthen (ASCII > 64 and ASCII < 91) | For capital letters . ASCII = ASCII + 32 | Change them to lower case . elseif (ASCII > 96 and ASCII < 123) | For lower case . ASCII = ASCII - 32 | Change them to upper case . endif . endif . ifthen ((ASCII > 64 and ASCII < 78) or (ASCII > 96 and ASCII < 110)) | Switch letters around . CODED$ = CODED$ + char(ASCII + 13) | in a uniform way . elseif ((ASCII > 77 and ASCII < 91) or (ASCII > 109 and ASCII < 123)) | so that the same process . CODED$ = CODED$ + char(ASCII - 13) | will revert them to their . elseif (ASCII > 31 and ASCII < 49) | original values. . CODED$ = CODED$ + char(ASCII + 17) . elseif (ASCII > 48 and ASCII < 65) . CODED$ = CODED$ + char(ASCII - 17) . endif . end for end subroutine