summaryrefslogtreecommitdiff
path: root/ipl/progs/crypt.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/progs/crypt.icn')
-rw-r--r--ipl/progs/crypt.icn59
1 files changed, 59 insertions, 0 deletions
diff --git a/ipl/progs/crypt.icn b/ipl/progs/crypt.icn
new file mode 100644
index 0000000..086a5f1
--- /dev/null
+++ b/ipl/progs/crypt.icn
@@ -0,0 +1,59 @@
+############################################################################
+#
+# 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