; DECRYPT
;
; Program for Proteus
;
; (C) 1998-2004 Simone Zanella Productions
;
; Decrypt the file using the keys specified; if you need to specify more
; than one key, enclose them between double quotes.
IF OR(ISEMPTY(ARGV(5)), ISEMPTY(ARGV(6)))
CONSOLELN "Syntax: " ARGV(1) " " ARGV(2) \
" .. destination filename \"key [key..]\""
CONSOLELN ""
CONSOLELN "Purpose: decrypt \"filename\" to destination using " \
"the specified keys."
ABORT 0
FI
H = FOPEN(ARGV(5), 1)
IF EQ(H, -1)
CONSOLELN "File \"" ARGV(5) "\" not found."
ABORT 1
FI
V = VECSPLIT(STRIPQUOTES(ARGV(6)), " ")
WHILE NOT(FEOF(H))
S = FREAD(H, 4096)
IF STRLEN(S)
FOR X = VECLEN(V) TO 1 STEP -1
DECRYPT(@S, VECGET(V, X))
NEXT
PRINT S
FI
LOOP
FCLOSE(H)
ABORT 0