home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d133
/
crc
/
information
< prev
next >
Wrap
Text File
|
1988-03-13
|
8KB
|
265 lines
Information On CRC & RLS
INTRODUCTION
This file describes two programs, CRC and RLS. CRC
calculates a 16 bit crc (cyclic redundancy check) using
the CCITT polynomial. RLS is used to recursively list the
paths of all files contained within a given directory.
CRC was written mainly to verify files on a recoverable
RAM disk, after a system crash. CRC's usefulness is not
limited to RAM disks. CRC is useful whenever it is
neccessary or desireable to verify the contents of a file
without the inconvenience of actually having direct
access to both the file in question, and a duplicate. It
performs essentially the same function as a program
written for CP/M systems called "CRC.COM"
RLS was written to make it easy to generate CRC's for all
files contained in a given directory system. RLS might
also be used in conjunction with a disk cataloging
system.
RLS
Many times I've wanted to generate a listing of all the
files on a disk (with complete pathnames), but never had
a simple tool that would do it. After a bit of
frustration of using the AmigaDOS command "DIR" with OPT
A, into a file, and then editing the file, I decided
enough was enough. I broke down and wrote RLS. All I have
to do now is enter "rls >tmp df2:" and all the pathnames
to all the files on drive df2: are stored in file "tmp".
CRC
CRC provides a means of verifying two files that are
expected to be exact duplicates, are indeed exact
duplicates. The two files do not have to be in the same
place at the same time either. A person could transfer a
file from his machine to anyone else's. The person at
each end of the transfer can generate a CRC for his copy
of the file. If the CRC's match, they can be relatively
certain (>99%) that the two files are exact duplicates.
CRC provides an external means of verifying the validity
of file contents. External in the sense that the user has
control of when and which files are checked. For example,
using X-MODEM protocol, a file could be transfered over a
serial port. The file's contents are only verified as
each packet is received. After the file has been
received, the user is on his own in the matter of whether
the files are correct.
Another instance would be copying data from a flakey
disk. The operating system stores some type of crc with
each sector, but the user doesn't really have access to
them. Suppose this disk kept having read errors while
(11/14/87) Page 1
Information On CRC & RLS
copying a file off of it. After many tries, a user
finally was able to make a copy of a file without
receiving an error message. Further, when the data was
finally read off the disk, the user doesn't have any
guarantee that the data was indeed read correctly. If
things happened just right, the crc might have been read
erroneously and happened to match erroneous data. This
isn't likely, but when dealing with a disk that has a
problem in the first place, the liklihood increases.
Using CRC, the user has an extra method of verifying the
file contents.
CRC parses off file names from the command-line and
generates a crc for each file. Every time a file is
changed, the crc generated by "crc" will change. Since
the crc may only have one of 65,536 different values,
some files may have the same crc.
A crc is better than a check-sum for most applications.
There are a number of reason's for this but one of the
simplest examples is that inserting a 00 byte into a file
will never change a simple checksum; it may on the other
hand change a crc.
Areas of Use
This program has potential in three areas. The first is
in disk-to-disk software distribution. A file could be
generated with crc's for all files on the disk. The disk
could then be copied and distributed. Each end user could
then run the "crc" program on all the files on the disk.
If the crc's generated match the stored crc's, then the
user can rest assured that the files are likely to be
exact duplicates. This provides the user a simple means
of verifying his disk without having to distribute a
second disk. An excellent application would be the Fred
Fish disks. Each disk could contain one file containing
the names and crc's for all files on the disk. Each end
user/owner of a disk could verify he had an error-free
copy by simply running "crc". More often than I like, I
have had to make a copy of a Fred Fish disk that had
errors.
The second area of use is in telecomputing. If a BBS made
a list of crc's available for all their download files,
users would be able to verify they had a good copy. This
would also help users identify terminal programs that
"chop" (binary) files.
The third area is the real reason I wrote this program in
the first place, recoverable RAM disks/devices. When a
program goes hay-wire and causes the system (and that 1
Tera-Byte RAM disk, you know, the one it took 6 days to
load from 437 floppies) to go from 7.144 MHz to 0 in 3
seconds, giving a blasted Guru Meditation message, it's
real nice to have a recoverable type RAM disk. But, if
the program went haywire, what kept it from doing a
scatter shot mess in your RAM disk? Nothing, unless you
(11/14/87) Page 2
Information On CRC & RLS
have some type of hardware protection. And how would you
notice if one of those scatter shots happened to hit
maybe one byte of your 100K byte compiler or that neat
300K CAD program? You probably wouldn't notice right away
without CRC. According to Murphy's Law, the program would
work 99.9% of the time you use it; only when you try to
save what you're working on will it crash the system
again. Well, if you run all the files on the recoverable
RAM disk through "crc" at each re-boot and compare the
crc's to the originals, you can be 99% certain.
Examples
I regularly use a large recoverable ram disk and use crc
to verify it's contents after every system crash. A
simple way to set things up would be this:
1. generate crc's for all files/commands you intend to
keep on the RRAM disk. Save the list into a file. Edit
the listing file; change all the file names to
reference the RRAM disk. Save this list to the boot
disk.
This might be as simple as this:
crc >listfile df0:c/*
; now edit the listfile and change all df0:'s to RRAM: or whatever
; your RRAM disk's device name is
copy listfile df0:listfile
2. change the startup-sequence on the boot-disk to do the
following
failat 11
crc <df0:lisfile -v
if ERROR
echo "errors were detected on RRAM disk"
makedir RRAM:c
copy df0:c RRAM:c
else
echo "All RRAM files check out, using them"
endif
To generate crc's for a particular Fish disk, you could
do this:
1. Insert the desired Fish disk into drive df1:
2. Type this into the CLI:
rls >ram:tmp
3. Type this into the CLI:
crc >ram:crclist -g ram:tmp
Now all the crc's should be stored in the file "crclist"
in RAM:.
The benefits you gain from using this program may never
(11/14/87) Page 3
Information On CRC & RLS
be noticed. Only pains from not using this program will
make you appreciate it.
I hope you never notice,
Don Kindred
(11/14/87) Page 4