SUB Encrypt2 (PassWord$, X$) ' +---------------------------------------------------------------------+ ' | | ' | - S U B E n c r y p t - | ' | | ' | | ' | Public Domain - FreeWare | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | SUB Encrypt is a simple, yet difficult to discipher or break | ' | encryption SUB. Public Domain, FreeWare. Written by | ' | Don Smith on 09-09-2007. EMail: smithdonb@earthlink.net | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | - ABOUT THE AUTHOR - | ' +---------------------------------------------------------------------+ ' | | ' | Hello. My name is Don Smith and I am a retired Math/History/Spanish | ' | teacher residing in Orange County, California. I am also a former | ' | 6-year Sergeant of Marines. Who-Rah! On certain forums I am known | ' | as MarineDon. My email is: smithdonb@earthlink.net | ' | | ' +---------------------------------------------------------------------+ ' | - COPYING AND DISTIBUTING - | ' +---------------------------------------------------------------------+ ' | Since this code is public domain and freeware, anyone may freely | ' | copy and distribute it. If you use the QuickBasic code in one of | ' | your own programs, you do not have to cite my name as the author, | ' | and you may even change its name. | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | A short program to try out SUB Encrypt is next. Notice that I have | ' | created PassWord$ as a string of extended ASCII characters. The | ' | Password does NOT get encrypted. The X$ string DOES get encrypted. | ' +---------------------------------------------------------------------+ ' ' DECLARE SUB Encrypt2 (PassWord$, X$) ' ' PWord1$ = CHR$(192) + CHR$(171) + CHR$(254) + CHR$(240) ' PWord2$ = CHR$(193) + CHR$(246) + CHR$(189) + CHR$(249) ' PassWord$ = PWord1$ + PWord2$ ' 'PassWord$ is a string of extended ASCII charaters ' 'which look like this: À«þðÁö½ù Would be very ' 'difficult to break or descipher this password. ' ' COLOR 15, 1: CLS : LOCATE 3, 1 ' X$ = "temp.txt" ' LINE INPUT "What is your one-line message? "; X$ ' CALL Encrypt(PassWord$, X$) ' PRINT ' PRINT "Encrypted Message is: " ' PRINT " "; X$ ' PRINT ' PRINT "Press any key to decrypt Message back to the original" ' DO: LOOP WHILE INKEY$ = "" ' PRINT ' PRINT ' PRINT ' ' CALL Encrypt(PassWord$, X$) ' PRINT "Message is back to its orignal form: " ' PRINT " "; X$ ' PRINT ' PRINT "Press any key to exit" ' DO: LOOP WHILE INKEY$ = "" ' END SUB Encrypt2 (PassWord$, X$) L = LEN(PassWord$) FOR X = 1 TO LEN(X$) Pass = ASC(MID$(PassWord$, (X MOD L) - L * ((X MOD L) = 0), 1)) MID$(X$, X, 1) = CHR$(ASC(MID$(X$, X, 1)) XOR Pass) NEXT END SUB