home *** CD-ROM | disk | FTP | other *** search
- From: blackman@cs.buffalo.edu ()
- Newsgroups: comp.sources.misc
- Subject: v39i066: syf - file encryption program, Part01/01
- Date: 31 Aug 1993 09:32:49 +0100
- Sender: aem@aber.ac.uk
- Approved: aem@aber.ac.uk
- Message-ID: <25v2bh$qlo@uk-usenet.uk.sun.com>
- X-Md4-Signature: a4efa11f1d0f93b90d4d4a3162bc455d
-
- Submitted-by: blackman@cs.buffalo.edu ()
- Posting-number: Volume 39, Issue 66
- Archive-name: syf/part01
- Environment: C
-
- [NB: this program was submitted for posting; without documentation or
- clear contact addresses. Hence, the software has been heavily
- repackaged to make it suitable for posting, but I thereby do not accept
- any responsibility for the usability of the package, or it's operational
- ability. +Alec-]
-
- #! /bin/sh
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: MANIFEST POSTER syf.c
- # Wrapped by alecm@uk-usenet on Tue Aug 31 09:24:12 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 1)."'
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(236 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X----------------------------------------------------------
- XMANIFEST 1 this file
- XPOSTER 1 contact information from poster
- Xsyf.c 1 source code
- END_OF_FILE
- if test 236 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'POSTER' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'POSTER'\"
- else
- echo shar: Extracting \"'POSTER'\" \(802 characters\)
- sed "s/^X//" >'POSTER' <<'END_OF_FILE'
- X[NB: this program was submitted for posting; without documentation or
- Xclear contact addresses. Hence, the software has been heavily
- Xrepackaged to make it suitable for posting, but I thereby do not accept
- Xany responsibility for the usability of the package, or it's operational
- Xability. +Alec-]
- X
- XPath: blackman
- XFrom: blackman@cs.buffalo.edu (Cancholech)
- XSubject: syf.c - file encryption program
- XMessage-Id: <CC4nwz.n0B@acsu.buffalo.edu>
- XSender: nntp@acsu.buffalo.edu
- XNntp-Posting-Host: armstrong.cs.buffalo.edu
- XOrganization: UB
- XX-Newsreader: TIN [version 1.1 PL8]
- XDate: Sat, 21 Aug 1993 21:05:22 GMT
- XLines: 69
- XApparently-To: comp-sources-misc@cis.ohio-state.edu
- X
- X--
- XWhat need sheep the shepherds knowledge?
- X-- Use with my permission, if you understand.
- Xrutgers!ub!blackman blackman@cs.buffalo.edu
- X
- END_OF_FILE
- if test 802 -ne `wc -c <'POSTER'`; then
- echo shar: \"'POSTER'\" unpacked with wrong size!
- fi
- # end of 'POSTER'
- fi
- if test -f 'syf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'syf.c'\"
- else
- echo shar: Extracting \"'syf.c'\" \(1102 characters\)
- sed "s/^X//" >'syf.c' <<'END_OF_FILE'
- X/* cypher.c david stafford computer shopper */
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X
- X#define MULTIPLIER 0x015A4E35L
- X#define INCREMENT 1
- X
- Xlong RandomSeed;
- X
- Xint GetRandomNumber( int Range )
- X{
- XRandomSeed = MULTIPLIER*RandomSeed+INCREMENT;
- X
- Xreturn(RandomSeed%Range);
- X}
- X
- Xvoid Cipher(FILE*InFile,FILE*OutFile)
- X{
- Xint Ch;
- Xwhile ((Ch=getc(InFile))!=EOF)
- X {
- X fputc(Ch ^ GetRandomNumber(256),OutFile);
- X }
- X}
- X
- Xvoid Supervisor( long Key, char *InFileName, char *OutFileName)
- X{
- XFILE*InFile, *OutFile;
- Xif((InFile=fopen(InFileName,"rb"))!=NULL)
- X {
- Xif((OutFile=fopen(OutFileName,"wb"))!=NULL)
- X {
- X RandomSeed=Key;
- XCipher(InFile,OutFile);
- Xfclose(OutFile);
- X }
- Xelse
- X {
- Xprintf("Can't open output file %s\n",OutFileName);
- X}
- Xfclose (InFile);
- X}
- Xelse
- X {
- Xprintf("Can't open input file %s\n",InFileName);
- X}
- X}
- X
- Xvoid main(int Argc, char *Argv[])
- X{
- Xif(Argc==4)
- X {
- XSupervisor(atol(Argv[1]),Argv[2],Argv[3]);
- X }
- Xelse
- X {
- Xputs("Cipher- File encryption/decryption\n");
- Xputs("Usage: cipher_key input_file output_file\n");
- Xputs(" cipher_key is an integer");
- Xputs(" input_file & output_file are the file names\n");
- X}
- X}
- END_OF_FILE
- if test 1102 -ne `wc -c <'syf.c'`; then
- echo shar: \"'syf.c'\" unpacked with wrong size!
- fi
- # end of 'syf.c'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-