home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 99
/
af099a.adf
/
archives
/
af99a2.lzx
/
ARexx_Tutorial
/
Encrypt1.rexx
next >
Wrap
OS/2 REXX Batch file
|
1984-04-13
|
1KB
|
72 lines
/* -------------------------------------------------------- */
/* encrypt1.rexx */
/* -------------------------------------------------------- */
SOURCE_PROMPT='Please enter source file name'
DEST_PROMPT='Please enter destination file name'
KEY_PROMPT='Please enter encryption key'
SOURCE_ERROR='cannot open source file'
DESTINATION_ERROR='cannot open destination file'
END_PROMPT='All done!'
/* -------------------------------------------------------- */
say SOURCE_PROMPT; pull source_name
say DEST_PROMPT; pull dest_name
say KEY_PROMPT; parse pull key
if Open(s,source_name,'r') then
do
if Open(d,dest_name,'w') then
do
n=0
key_length=Length(key)
c=Readch(s)
do until EOF(s)
key_character=SubStr(key,((n//key_length)+1),1)
c=BitXOR(c,key_character)
Writech(d,c)
n=n+1
c=Readch(s)
end /* while EOF() loop */
say END_PROMPT
Close(d)
end /* open dest */
else say DEST_ERROR
end /* open source */
else say SOURCE_ERROR
Close(s)
/* -------------------------------------------------------- */