home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
progs
/
crypt.icn
< prev
next >
Wrap
Text File
|
2000-07-29
|
1KB
|
60 lines
############################################################################
#
# File: crypt.icn
#
# Subject: Program to encrypt file
#
# Authors: Phil Bewig and Phillip Lee Thomas
#
# Date: August 14, 1996
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# Do *not* use this in the face of competent cryptanalysis.
#
# Usage: [iconx] icrypt [key] < infile > outfile
#
############################################################################
#
# As written, uses UNIX-style console I/O.
#
############################################################################
procedure main(args)
local i, k, ky, l, con
local fin, fout, infile, outfile
if *args = 3 then {
ky := get(args)
infile := get(args)
outfile := get(args)
}
else {
writes("Enter password: ")
# Note - password is visible
ky := read()
writes("Enter input file: ")
infile := read()
writes("Enter output file: ")
outfile := read()
}
fin := open(infile, "ur")
fout := open(outfile,"uw")
i := 1
l := 0
k := []
every put(k, ord(!ky)) do
l +:= 1
while writes(fout, char(ixor(ord(reads(fin)), k[i]))) do {
i := (i % l) + 1
}
end