TECHNICAL FIELD
This application relates to verifying the integrity of data transmissions, and more particularly, to verifying the integrity of digital data transmissions using cyclic redundancy codes.
BACKGROUND
Data transmission 10 (FIG. 1) involves a transfer of information known as data between a sender 12 and a receiver 14. Often, data transmission 10 includes information transmitted as digital bits of ones and zeros, represented here by m.sub.n-1to m.sub.0, and referred to as a message M.
In a perfect world, message M transmits free of errors. Unfortunately, errors are often introduced though medium 16 by which message M travels from sender 12 to receiver 14 (e.g., medium 16 may be any combination of wire, cable, fiber-optic,air, or link layer devices). One method for detecting the presence of errors in message M employs cyclic redundancy codes.
Cyclic redundancy codes treat groupings of digital bits like message M as a polynomial where each bit in the grouping represents a coefficient in the polynomial X.sup.n-1+X.sup.n-2+X.sup.0. For example, a group of eight bits 11001101 may berepresented by polynomial X.sup.7+X.sup.6+X.sup.3+X.sup.2+1 (i.e., 1*X.sup.7+1*X.sup.6+0*X.sup.5+0*X.sup.4+1*X.sup.3+1*X.sup.2+0*X.sup.1+1*X- .sup.0).
These polynomials form an algebraic object known as a commutative ring with coefficients in Z/p where Z are the integers and p is a prime number, here 2, also known as {0,1} modulo 2. A non empty set R together with two binary operations {+*} iscalled a ring if (R+) is an abelian group, (R*) is a semi group and the distributive laws are obeyed, (i.e. a*(b+c)=a*b+a*b).
In polynomial rings, there are no carries or borrows from one coefficient to the next. In arithmetic modulo 2, addition and subtraction are identical and may be implemented with exclusive-or.
.times..times..times..times. ##EQU00001##
Division of polynomials represented as groups of bits is completed in a manner similar to binary division except subtraction is done in modulo2. A divisor will `go into` a dividend if the dividend polynomial is of the same degree as the divisorpolynomial (i.e., the divisor and dividend share at least the same most significant bit).
A cyclic redundancy code may be obtained by calculating the remainder for message M divided by a generator polynomial P. This remainder is called a cyclic redundancy code ("CRC").
To obtain a CRC for a message M, the group of bits to be divided by generator polynomial P may include appended zero-bits 17. Zero-bits 17 are equal in number to the degree of generator polynomial P. Thus, the CRC of a message M=10111000 havingthree appended zero-bits 17 based on a generator polynomial P=X.sup.3+1=1001 of degree three (i.e., where X.sup.3 is the most significant bit of polynomial P) may be calculated as follows:
##STR00001##
The resulting remainder, shown as CRC 18, may be appended to message M, replacing zero bits 17, to create a message M'. Sender 12 transmits message M' via medium 16 to receiver 14 as data transmission 10.
Upon receipt, receiver 14 divides message M' by the same generator polynomial P to obtain a CRC for M' and check the validity of data transmission 10. If the resulting remainder is zero (i.e., CRC=M'(modulo)P=0), the integrity of datatransmission 10 is confirmed. For example:
##STR00002##
If the remainder of message M' divided by polynomial P is not zero (i.e., CRC=M'(modulo)P.noteq.0), data transmission 10 contains one or more errors. For example:
##STR00003##
DESCRIPTION OF DRAWINGS
FIG. 1 shows a prior art block diagram of a data transmission employing cyclic redundancy codes.
FIG. 2 shows a process for obtaining a CRC where a message M is separated into a plurality of segments.
FIG. 3 shows a CRC generator for obtaining a CRC of a message according to the process in FIG. 2.
FIG. 4 shows the CRC generator of FIG. 3 separated into four segments.
FIG. 5 shows a CRC generator for obtaining a CRC of a message M according to the process in FIG. 2.
FIG. 6 shows a modulo unit for obtaining a remainder of a message using a reciprocal approximation of a generator polynomial.
FIG. 7 shows the CRC generator in FIG. 3 using the modulo unit in FIG. 6.
FIG. 8 shows a CRC generator for updating a CRC of a message M where a portion of message M has been adjusted.
FIG. 9 shows the CRC generator in FIG. 8 operating on an adjusted segment of message M.
FIG. 10 is a view of computer hardware used to implement an embodiment of the invention.
Like reference symbols in the various drawings indicate like elements.
DETAILED DESCRIPTION
Process 20 (FIG. 2) obtains a CRC for a message M based on a generator polynomial P.
Process 20 includes separating (201) a message M into a plurality of message segments M.sub.s; moduloing (defined below) (203) the message segments by a generator polynomial P, if needed, to obtain a remainder R for each segment; multiplying(205) the remainder R for each segment by an appropriate segment-constant C to obtain a segment-remainder SR for each segment M.sub.s; accumulating (207) the segment-remainders SR for each segment M.sub.s to obtain an accumulated-remainder AR for messageM; and moduloing (209) the accumulated-remainder by generator polynomial P, if needed, to obtain the CRC for message M.
Separating (201) message M into a plurality of message segments M.sub.s includes parsing message M so that: M=M.sub.s-1*X.sup.n*(s-1)+M.sub.s-2*X.sup.n*(s-2) . . . +M.sub.1*X.sup.n(1)+M.sub.0*X.sup.n(0); where s is the number of segments intowhich message M is separated, n is the number of bits in each segment, X is the position of each segment in message M, and M.sub.s are the individual segments of message M. If the number of bits is n, then X is of the form X=[1000 . . . 0] where thereare n zeroes, n+1 elements, and X is of degree n. Multiplying M by X will shift the message left by n bits. Multiplying M by X.sup.2 will shift the message by 2n bits (and so on).
Moduloing (203) includes obtaining a remainder R for each message segment M.sub.s by dividing segment M.sub.s by generator polynomial P if the degree of the most significant bit of segment M.sub.s is the same as or greater than the degree of themost significant bit of polynomial P. If the degree of segment M.sub.s is less than the degree of polynomial P (i.e., where the most significant bit of M.sub.s is smaller than the most significant bit of polynomial P) moduloing (203) is not needed sincethe remainder for message segment M.sub.s equals segment M.sub.s itself. In alternate embodiments moduloing (203) may be accomplished by multiplying message segment M.sub.s by a reciprocal approximation for polynomial P, rather than dividing segmentM.sub.s by polynomial P. to obtain remainder R for message segment M.sub.s. The operation of multiplication by reciprocal approximation to obtain a remainder R is discussed in connection with FIG. 6 below.
Multiplying (205) includes obtaining segment-constant C (defined below) for each message segment M.sub.s and multiplying each segment-constant C by its remainder R to obtain a segment-remainder SR for each message segment. Segment-constants Cmay be obtained based on the position X of message segment M.sub.s in message M modulo generator polynomial P or modulo a field extension of P.
Accumulation (207) includes adding the segment-remainders SR for each message segment M.sub.s to obtain an accumulated-remainder AR for message M.
Moduloing (209) includes dividing accumulated-remainder AR by generator polynomial P, or multiplying AR by a reciprocal approximation of generator polynomial P, to obtain a CRC for message M. However, if the degree of accumulated-remainder AR isless than the degree of polynomial P, moduloing (209) is not needed since the remainder (i.e., the CRC) of message M is accumulated-remainder AR.
FIG. 3 shows an implementation of process 20 for calculating a CRC of message M based on generator polynomial P. For example: if M=10111000, (Message 10111 with with 3 zero-bits appended) s=2, n=4, and P=1001=(Deg(P)=3); then M may be separatedas M.sub.s-1=M.sub.1=1011=segment 33, X.sup.n*(s-1)=X.sup.4=10000, M.sub.s-2=M.sub.0=1000=segment 35, X.sup.n*(s-2)=X.sup.0=00001; where M=1011*10000+1000*00001=10111000.
CRC generator 30 obtains a CRC for message M based on generator polynomial P, where the CRC for message M is the remainder of message M divided by polynomial P (i.e., CRC=M(modulo)P=MOD(M, P).
Typically, generator polynomials P are selected because they are irreducible (i.e., they have no factors). Several examples of well-known generator polynomials include:
.times..times..times..times..times..times..times..times..times..times..tim- es..times..times..times..times..times..times..times..times..times..times..- times..times..times..times..times. ##EQU00002## where LRCC stands for Last RegistrationControl Channel.
CRC generator 30 includes modulo unit 32, multiplier 34, accumulator 36, and modulo unit 38. Here, modulo unit 32 has modulo units 32a and 32b implemented in hardware.
Modulo unit 32a divides message segment 33 by generator polynomial P to obtain remainder R.sub.i+1 (i.e., R.sub.i+1=M.sub.s-1(modulo)P=MOD(M.sub.s-1, P)). Modulo unit 32b divides message segment 35 by generator polynomial P to obtain remainderR.sub.i (i.e., R.sub.i=M.sub.s-2(modulo)P=MOD(M.sub.s-2, P)). For example: if M=10111000, M.sub.s-1=M.sub.1=1011=segment 33, M.sub.s-2=M.sub.0=1000=segment 35, and P=1001; then
.times..function..times..function..times..times..times..times..function..t- imes..function..times..times..times. ##EQU00003## where
##STR00004##
Multiplier 34 multiplies remainders R.sub.i+1 and R.sub.i by segment-constants C.sub.i+1 and C.sub.i to obtain segment-remainders SR.sub.i+1 and SR.sub.i. Here, segment-constants C.sub.i+1 and C.sub.i are obtained by moduloing the position X ofsegments 33 and 35 in message M by generator polynomial P (i.e., C.sub.i+1=X.sup.n*(i+1)(modulo)P and C.sub.i=X.sup.n*i(modulo)P). For example: if M=10111000, P=1001, s=2, and n=4; then for
.times..times..function..times..times..times..times..times..times..functio- n..times..times..times..times. ##EQU00004## where
##STR00005##
Segment-constants C.sub.i+1 and C.sub.i may be obtained in advance, based on a known segmentation of message M and stored in memory unit 39, which is accessible to CRC generator 30. In other embodiments, segment-constants C.sub.i+1 and C.sub.imay be obtained `on the fly` within CRC generator 30 upon receipt of message M.
Multiplier 34 includes multipliers 34a and 34b. Multiplier 34a multiplies remainder R.sub.i+1 by segment-constant C.sub.i+1 to obtain segment-remainder SR.sub.i+1. Multiplier 34b multiplies remainder R.sub.i by segment constant C.sub.i toobtain segment-remainder SR.sub.i. For example: if R.sub.i+1=010, C.sub.i+1=010 and (from above) R.sub.i=001, C.sub.i=001; then SR.sub.i+1=R.sub.i+1*C.sub.i+1=010*010=00100, and SR.sub.i=R.sub.i*C.sub.1=001*001=00001; where
.times..times..times..times..times..times..times..times..times..times..tim- es..times..times..times..times..times..times..times. ##EQU00005##
Accumulator 36 adds segment-remainders SR.sub.i+1 and SR.sub.i together to obtain accumulated-remainder AR. For example: if SR.sub.i+1=SR.sub.1=00100, (from above) SR.sub.i=SR.sub.0=00001; then AR=00100+00001=00101, where
.times..times..times. ##EQU00006##
Modulo unit 38 obtains the CRC for message M by moduloing accumulated-remainder AR by generator polynomial P (i.e., CRC=AR(modulo)P=MOD(AR, P)). For example: if AR=00101, and (from above) P=1001; then
.times..function..times..function..times..times..times. ##EQU00007## where
##STR00006##
Hence, process 20 implemented on CRC generator 30 obtains the same CRC for message M, here 10111000. In this example, moduloing AR by polynomial P is not needed since the degree of AR was less than the degree of P.
CRC generator 30 may be expanded to include enough components for obtaining the CRC for message M separated into N segments. FIG. 4 shows CRC generator 40 capable of operating on message M separated into four (4) segments 43, 45, 47 and 49. Forexample: if M=M'=10111101, (e.g., message M in the example for FIG. 3 above having the obtained CRC appended to it) s=4, n=2, and p=2; then M may be separated as M.sub.s-1=M.sub.3=10=segment 43, X.sup.n*(s-1)=X.sup.6=1000000, M.sub.s-2=M.sub.2=11=segment45, X.sup.n*(s-2)=X.sup.4=10000, M.sub.s-3=M.sub.1=11=segment 47, X.sup.n*(s-3)=X.sup.2=100, M.sub.s-4=M.sub.0=01=segment 49, X.sup.n*(s-4)=X.sup.0=001; where M=10*1000000+11*10000+11*100+01*001=10111101.
CRC generator 40 includes modulo unit 42, multipliers 44, accumulator 46, and modulo unit 48. Modulo unit 42 includes modulo units 42a, 42b, 42c and 42d. Modulo units 42a, 42b, 42c and 42d each operate to divide message segment 43, 45, 47 and49 by generator polynomial P to obtain remainders R.sub.3, R.sub.2, R.sub.1 and R.sub.0. For example: if M=10111101=M', (from above) M.sub.s-1=M.sub.3=10=segment 43, M.sub.s-2=M.sub.2=11=segment 45, M.sub.s-3=M.sub.1=11=segment 47,M.sub.s-4=M.sub.0=01=segment 49, and P=1001; then
.times..function..times..times..times..times..times..function..times..time- s..times..times..times..function..times..times..times..times..times..funct- ion..times..times..times..times. ##EQU00008##
Multiplier 44 multiplies remainders R.sub.3 to R.sub.0 by segment-constants C.sub.3 to C.sub.0 to obtain segment-remainders SR.sub.3 to SR.sub.0. Segment-constants C.sub.3 to C.sub.0 correspond to each particular segment 43, 45, 47 and 49 andmay be obtained by moduloing the position of segments in message M by polynomial P. (i.e., C.sub.3=X.sup.n*(3)(modulo)P, C.sub.2=X.sup.n*2(modulo)P, C.sub.1=X.sup.n*1(modulo)P, C.sub.0=X.sup.n*0(modulo)P). For example: if M=10111101, (from above)P=1001, s=4, and n=2; then
.times..times..function..times..times..times..times..times..times..times..- function..times..times..times..times..times..times..times..function..times- ..times..times..times..times..times..times..function..times..times..times.- .times. ##EQU00009##
Segment constants C.sub.3 to C.sub.0 may be obtained in advance based on the segmentation of message M and stored in a memory unit 39 (FIG. 3) accessible to CRC generator 40. In other embodiments C.sub.3 to C.sub.0 may be obtained `on the fly`(i.e., in real-time)within CRC generator 40 as it receives message M.
Multiplier 44 multiplies R.sub.3 by C.sub.3, R.sub.2 by C.sub.2, R.sub.1 by C.sub.1, and R.sub.0 by C.sub.0 to obtain segment-remainders SR.sub.3 to SR.sub.0. For example: if R.sub.i+3=R.sub.3=10, C.sub.i+3=C.sub.3=001; (from above)R.sub.i+2=R.sub.2=11, C.sub.i+2=C.sub.2=010; R.sub.i+1=R.sub.1=11, C.sub.i+1=C.sub.1=100; and R.sub.i=R.sub.0=01, C.sub.i=C.sub.i0=001; then SR.sub.3=R.sub.3*C.sub.3=10*001=0010; SR.sub.2=R.sub.2*C.sub.2=11*010=0110; SR.sub.1=R.sub.1*C.sub.1=11*100=1100;and SR.sub.0=R.sub.0*C.sub.0=01*001=0001.
Accumulator 46 adds segment-remainders SR.sub.3 to SR.sub.0 together to obtain accumulated-remainder AR. Here, accumulator 46 includes accumulators 46a, 46b and 46c, where accumulators 46a and 46b compute temporary accumulations T.sub.1 andT.sub.0 and accumulator 46c combines temporary accumulations T.sub.1 and T.sub.0 to obtain accumulated-remainder AR. For example: if SR.sub.i+3=SR.sub.3=0010, (from above) SR.sub.i+2=SR.sub.2=0110, SR.sub.i+1=SR.sub.1=1100, and SR.sub.i=SR.sub.0=0001;then T.sub.1=0010+0110=0100, T.sub.0=1100+0001=1101, and AR=0100+1101=1001.
Finally, modulo unit 48 obtains the CRC for message M, here message M' having the CRC obtained as described in FIG. 3 above, by moduloing accumulated-remainder AR by polynomial P (i.e., CRC=AR(modulo)P=MOD(AR, P). For example: if AR=1001, and(from above) P=1001; then CRC=AR(modulo)P=1001(modulo)1001=0 where
##STR00007##
Thus, CRC generator 40 verifies the integrity of message M from the example in FIG. 3 where the CRC of message M was appended to form M' and transmitted to a receiver 14 who confirmed the transmission using CRC generator 40 (FIG. 4).
According to process 20, CRC generators 30 and 40 may be further simplified where the degree of message segments M.sub.s are less than the degree of generator polynomial P (i.e., Deg(M.sub.s)<Deg(P)). As shown in the example for FIG. 4 above,the remainder R of M.sub.s(modulo)P equals M.sub.s when the degree of M.sub.s is less than the degree of P. Thus, CRC generator 50 (FIG. 5) does not need an initial modulo unit (e.g., 32 or 42) for obtaining a remainder R.sub.i of message segmentsM.sub.s that are of a degree less than the degree of generator polynomial P. For segments of degree equal to P (i.e., Deg(M.sub.s)=Deg(P)) modulo units 32 or 42 may be replaced by an xor, as M.sub.s(modulo)P equals M.sub.s-P.
Here, CRC generator 50 includes multiplier 54, accumulator 56, and modulo unit 58, which operate to obtain a CRC for message M separated into four segments 53, 55, 57 and 59 of a degree less than the degree of generator polynomial P (i.e.,Deg(M.sub.s)<Deg(P)). For example: if M=10111000, (M including 3 appended zero bits as in FIG. 3 above) s=4, n=2, and P=1001; then M.sub.s-1=M.sub.3=10=segment 53, X.sup.n*(s-1)=X.sup.6=1000000, M.sub.s-2=M.sub.2=11=segment 55,X.sup.n*(s-2)=X.sup.4=10000, M.sub.s-3=M.sub.1=10=segment 57, X.sup.n*(s-3)=X.sup.2=100, M.sub.s-4=M.sub.0=00=segment 59, X.sup.n*(s-4)=X.sup.0=001; and
##EQU00010##
Multiplier 54 multiplies segments 53 to 59 by segment-constants C.sub.3 to C.sub.0 to obtain segment-remainders SR.sub.3 to SR.sub.0. Segment-constants C.sub.3 to C.sub.0 may be obtained in advance or calculated `on the fly` as described above. For example: if M=10111000, (from above) P=1001, s=4, and n=2; then
.times..times..function..times..times..times..times..times..times..times..- function..times..times..times..times..times..times..times..function..times- ..times..times..times..times..times..times..function..times..times..times.- .times. ##EQU00011##
Multiplier 54 multiplies M.sub.3 by C.sub.3, M.sub.2 by C.sub.2, M.sub.1 by C.sub.1, and M.sub.0 by C.sub.0 to obtain segment-remainders SR.sub.3 to SR.sub.0, since each message segment M.sub.s equals its remainder R. For example: ifM.sub.s-1=M.sub.3=10, C.sub.i+3=C.sub.3=001, M.sub.s-2=M.sub.2=11, C.sub.i+2=C.sub.2=010, M.sub.s-3=M.sub.1=10, C.sub.i+1=C.sub.1=100, and M.sub.s-4=M.sub.0=00, C.sub.i=C.sub.i0=001; then SR.sub.3=M.sub.3*C.sub.3=10*001=0010,SR.sub.2=M.sub.2*C.sub.2=11*010=0110, SR.sub.1=M.sub.1*C.sub.1=10*100=1000, and SR.sub.0=M.sub.0*C.sub.0=00*001=0000.
Accumulator 56 adds segment-remainders SR.sub.3 to SR.sub.0 together to obtain accumulated-remainder AR. Here, accumulator 56 includes accumulators 56a, 56b and 56c, where accumulators 56a and 56b compute temporary accumulations T.sub.1 andT.sub.0 and accumulator 56c combines temporary accumulations T.sub.1 and T.sub.0 to obtain accumulated-remainder AR. For example: if SR.sub.i+3=SR.sub.3=0010, (from above) SR.sub.i+2=SR.sub.2=0110, SR.sub.i+1=SR.sub.1=1000, and SR.sub.i=SR.sub.00000;then T.sub.1=0010+0110=0100; T.sub.0=1000+0000=1000; and AR=0100+1000=1100.
Finally, modulo unit 58 obtains a CRC for message M by moduloing accumulated-remainder AR by polynomial P. For example: if AR=1100, and (from above) P=1001; then CRC=AR(modulo)P=1100(modulo)1001=101; where
##STR00008##
Thus, CRC generator 50 obtains the same CRC for message M as calculated in the example in FIG. 3 above without needing modulo units 32 or 42 of FIGS. 3 and 4.
Moduloing (e.g., (203) and (209)) may also be accomplished by multiplying message M (or message segment M.sub.s) by a reciprocal approximation D of generator polynomial P and subtracting that result from message M (or message segment M.sub.s) toobtain a remainder R. Moduloing by multiplication by reciprocal approximator RA may be obtained based upon the following relationships: RA=X.sup.p+d/P; M/P=M*RA*1/X.sup.p+ra (for 0<=Deg(M)<=p+ra); M=(M/P)*P+M(modulo)P; R=M(modulo)P=M-(M/P)*P;R=M(modulo)P=M-(M*D/X.sup.p+ra)*P where X.sup.p+ra is a polynomial having a most significant bit of degree p+ra (i.e. Deg(X.sup.p+ra)=p+ra); p is the degree of generator polynomial P (i.e., Deg(P)=p); ra is the degree of reciprocal-approximator RA (i.e.,Deg(RA)=ra); and the degree of message M, for which remainder R is sought, is greater than zero and less than or equal to p+ra (i.e., 0<Deg(M)<=p+ra). For example: if M=10111000 (i.e., Deg(M)=7), and P=1001 (i.e., Deg(P)=3). thenreciprocal-approximator RA would have a degree of at least four (4) for p+ra to be greater than or equal to the degree of M, here seven (7). Thus: if M=10111000 (i.e., Deg(M)=7), P=1001 (i.e., Deg(P)=3); and; ra=4; then
.times..function. ##EQU00012## .times..times..times. ##EQU00012.2## where
##STR00009##
Modulo unit 60 may calculate reciprocal-approximator RA prior to receiving message M and store RA in memory 69 since both generator polynomial P and the degree of message M are known prior to receiving message M. In other embodiments,reciprocal-approximator RA may be built in or obtained `on-the fly` by modulo unit 60 after receiving message M. Once the form of the polynomial is fixed, the implementation of the corresponding hardware may be simplified considerably.
To obtain remainder R for message M modulo unit 60 includes multiplication unit 62, truncation unit 64, multiplication unit 66 and subtraction unit 68 where: T.sub.0=M*RA is performed by unit 62, T.sub.1=T.sub.0/X.sup.p+ra is performed by unit64, T.sub.2=T.sub.1*P is performed by unit 66, and R=M-T.sub.2 is performed by unit 68.
Multiplication unit 62 receives message M and multiplies M by reciprocal-approximator RA to obtain temporary result T.sub.0. For example: if M=10111000, (from FIG. 3 above) P=1001, and RA=10010; then
.times. ##EQU00013## where
##STR00010##
Multiplication unit 62 provides temporary result T.sub.0 to truncation unit 64, which divides T.sub.0 by X.sup.p+ra, here 10000000, to obtain truncated result T.sub.1. In other embodiments, truncation unit 64 may remove the p+ra leastsignificant bits of temporary result T.sub.0 without dividing by X.sup.p+ra to obtain truncated result T.sub.1. For example: if P=3, ra=4, and T.sub.0=101011110000; then p+ra=7, and T.sub.1=10101. Thus for p+ra equaling seven (7), the seven (7) leastsignificant bits, here 1110000, are removed from T.sub.0 to obtain T.sub.1.
Truncation unit 64 provides truncated result T.sub.1 to multiplication unit 66, which multiplies T.sub.1 by generator polynomial P to obtain temporary result T.sub.2. For example; if P=1001, and T.sub.1=10101; then T.sub.2=T.sub.1*P=10101*1001=10111101 where
##STR00011##
Multiplication unit 66 provides temporary result T.sub.2 to subtraction unit 68, which subtracts T.sub.2 from message M to obtain remainder R. For example: if M=10111000, and (from above) T.sub.2=10111101; then R=M-T.sub.2=101 where
##STR00012##
Thus, modulo unit 60 obtains remainder R for message M using multiplication by reciprocal approximation. Hence, modulo unit 60 may calculate the CRC for the entire message M on its own, or may be incorporated into CRC generators 30 and 40 toobtain remainders R for message segments M.sub.s.
For example, FIG. 7 shows an implementation of the CRC generator in FIG. 3 employing modulo unit 60 in FIG. 6. Here, modulo units 60 are show as MH (M, RA, P). For example: if M=10111000, (Same as in FIG. 3 above) s=2, n=4, and P=1001; then Mmay be separated as M.sub.s-1=M.sub.1=1011=segment 73 X.sup.n*(s-1)=X.sup.4=10000, M.sub.s-2=M.sub.0=1000=segment 75 X.sup.n*(s-2)=X.sup.0=00001; where M=1011*10000+1000*00001=10111000.
CRC generator 70 obtains a CRC for message M based on generator polynomial P, where the CRC for message M is the remainder of message M divided by polynomial P.
CRC generator 70 includes modulo unit 72, multiplier 74, accumulator 76, and modulo unit 78. Here, modulo unit 72 includes modulo units 72a and 72b, which multiply message segments 73 and 75 by a reciprocal approximation of generator polynomialP to obtain remainders R.sub.i+1 and R.sub.i.
Modulo unit 72a multiplies message segment 73 by reciprocal-approximator RA of generator polynomial P to obtain a remainder R as shown in FIG. 6. For example: if M=10111000, M.sub.s-1=M.sub.1=1011=segment 73, M.sub.s-2=M.sub.0=1000=segment 75,Deg(M.sub.s-1)=3 Deg(M.sub.s-2)=3 P=1001, and RA=X.sup.p+ra/P=X.sup.3+1/P, so that p+ra is greater than or equal to the degree of each message segment M.sub.s-1 and M.sub.s-2; then RA=X.sup.3+1/P=10000/1001=10; where
##STR00013## and T.sub.0(i+1)=M.sub.s-1*RA=1011*10=10110, T.sub.0(i)=M.sub.s-2*RA=1000*10=10000, T.sub.1(i+1)=T.sub.0(i+1)/X.sup.3+1=10110/10000=1, T.sub.1(i)=T.sub.0(i)/X.sup.3+1=10000/10000=1, T.sub.2(i+1)=T.sub.1(i+1)*P=1*1001=1001,T.sub.2(i)=T.sub.1(i)*P=1*1001=1001, R.sub.i+1=M.sub.s-1-T.sub.2(i+1)=1011-1001=010 R.sub.i=M.sub.s-2-T.sub.2(i)=1000-1001=001.
Hence, modulo units 72a and 72b obtain the same remainders R.sub.i+1 and R.sub.i as modulo units 32a and 32b in FIG. 3 above.
Multiplier 34 multiplies R.sub.i+1 and R.sub.i by segment-constants C.sub.i+1 and C.sub.i to obtain segment-remainders SR.sub.i+1 and SR.sub.i. Here, segment-constants C.sub.i+1 and C.sub.i are obtained `on the fly` by moduloing the position Xof segments 33 and 35 in message M by generator polynomial P (i.e., C.sub.i+1=X.sup.n*(i+1)(modulo)P and C.sub.i=X.sup.n*i(modulo)P) using modulo unit 60 described in FIG. 6. For example: if X.sup.n*(i+1)=X.sup.4*(1)=M.sub.1=10000,X.sup.n*i=X.sup.4*(0)=M.sub.0=00001, Deg(X.sup.4*(1))=4, Deg(X.sup.4*(0))=0, P=1001, and RA=X.sup.p+ra/P=X.sup.3+1/P, so that p+ra is greater than or equal to the degree of each message segment X.sup.4*(1) and X.sup.4*(0); then RA=10000/1001=10; andT.sub.0(i+1)=M.sub.1*RA=10000*10=100000, T.sub.0(i)=M.sub.0*RA=00001*10=000010, T.sub.1(i+1)=T.sub.0(i+1)/X.sup.3+1=100000/10000=10, T.sub.1(i)=T.sub.0(i)/X.sup.3+1=000010/10000=0, T.sub.2(i+1)=T.sub.1(i+1)*P=10*1001=10010,T.sub.2(i)=T.sub.1(i)*P=0*1001=00000, C.sub.i+1=M.sub.1-T.sub.2 (i+1)=10000-10010=010, C.sub.i=M.sub.0-T.sub.2(i)=00001-00000=001.
In other embodiments segment-constants C.sub.i+1 and C.sub.i may be obtained in advance in stored in a memory unit (e.g. 39).
Multiplier 74 includes multipliers 74a and 74b. Multiplier 74a multiplies remainder R.sub.i+1 by segment-constant C.sub.i+1 to obtain segment-remainder SR.sub.i+1. Multiplier 74b multiplies R.sub.i by segment constant C.sub.i to obtainsegment-remainder SR.sub.i. For example: if R.sub.i+1=010, C.sub.i+1=010 and (from above) R.sub.i=001, C.sub.i=001; then SR.sub.i+1=R.sub.i+1*C.sub.i+1=010*010=00100, and SR.sub.i=R.sub.i*C.sub.i=001*001=00001;
Accumulator 76 adds segment-remainders SR.sub.i+1 and SR.sub.i together to obtain accumulated-remainder AR. For example: if SR.sub.i+1=SR.sub.1=00100, SR.sub.i=SR.sub.0=00001; then AR=00100+00001=00101.
Modulo unit 78 obtains a CRC for message M by moduloing accumulated-remainder AR by generator polynomial P. Here, modulo unit 78 obtains the CRC by using multiplication by reciprocal approximation shown in FIG. 6. For example: if AR=M=00101,Deg(AR)=2 P=1001, and RA=X.sup.p+ra/P=X.sup.3+1/P so that p+ra is greater than or equal to the degree of the message for which a remainder is desired, here AR; then RA=10000/1001=10; and T.sub.0=M*RA=00101*10=1010, T.sub.1=T.sub.0/X.sup.3+1=1010/10000=0,T.sub.2=T.sub.1*P=0*1001=0, R=CRC=M-T.sub.2=00101-0=101.
Thus CRC generator 70 obtains the same CRC the example for CRC generator 30. Likewise, CRC generator 70 may also be expanded to include enough components for obtaining the CRC for message M separated into N segments.
CRC generator 80 (FIG. 8) includes subtraction unit 82, modulo unit 84 and accumulator 86 for updating a CRC of a message M adjusted during transmission. Subtraction unit 82 subtracts old message 83 from new message 85 to obtain difference D.For example: if
##STR00014## then D=M.sub.new-M.sub.old=00110000 wherein
##STR00015##
Modulo unit 84 modulos difference D by generator polynomial P to obtain a difference-remainder DR. For example: if P=1001, and D=00110000; then DR=D(modulo)P=MOD(D, P)= wherein
##STR00016##
In other embodiments, difference-remainder DR may be obtained using multiplication by reciprocal-approximator RA (i.e. MH (D, RA, P)).
Accumulator 86 adds difference-remainder DR and CRC.sub.old to obtain a CRC.sub.new. For example: if CRC.sub.old=101 and DR=110; then
.times..times. ##EQU00014## where
##STR00017##
The accuracy of this CRC.sub.new may be confirmed by replacing CRC.sub.old in the adjusted message M.sub.new with CRC.sub.new and determining whether M.sub.new(modulo)CRC.sub.new equals zero. For example:
.times. ##EQU00015## .times. ##EQU00015.2##
CRC generator 90 (FIG. 9) includes subtraction unit 92, modulo unit 94, multiplier 96, modulo unit 98 and accumulator 99 for updating a CRC of a message M adjusted during transmission. CRC generator 90 differs from generator 80 in that itadjusts the CRC of a message M based on the adjusted segment of the message.
Subtraction unit 92 subtracts old message segment 93 from new message segment 95 to obtain difference-segment DS. For example: if P=1001, n=2 s=4
##STR00018## then DS=M.sub.s-2(new)-M.sub.s-2(old)=00-11=11.
Modulo unit 94 modulos difference-segment DS by generator polynomial P to obtain a difference-segment-remainder DSR. For example: if P=1001, and DS=11; then DSR=DS(modulo)P=MOD(DS, P)=11 wherein
##STR00019##
Here, as above, if the difference-segment DS is of a lesser degree than polynomial P, modulo unit 94 is not needed since the modulo of DS equals DS.
Multiplier 96 multiplies difference-segment-remainder DSR by an appropriate segment-constant C.sub.i to obtain an expanded segment-remainder ESR. Segment-constants C.sub.3 to C.sub.0 for this example may be obtained as described above. Forexample: if DSR=(M.sub.2new-M.sub.2old)(modulo)P=11 and
.times..function..times..times..times..times. ##EQU00016## then EDR=DSR*C.sub.i=11*010=110.
Modulo unit 98 obtains message difference-remainder DR by moduloing the extended difference-remainder by generator polynomial P. For example: if P=1001 and EDR=110; then DR=110.
Again, for extended difference-remainders of a degree less than the degree of polynomial P the DR is the EDR.
Finally, accumulator 99 adds the message difference-remainder DR and CRC.sub.old to obtain a CRC.sub.new. For example: if CRC.sub.old=101 and DR=110; then
.times..times. ##EQU00017## wherein
.times..times..times. ##EQU00018##
All of the above algorithms may be affected by embedding generator polynomial P in a larger ring. For example, let F=P*Q;
where F is a field extension of P, Q is an extender, and the greatest common denominator between P and Q is one (1). Segment-constants C may now be calculated using field extension F, instead of p, and message segments Ms increased in size (bybit) accordingly without requiring the additional modulos 42 and 42 in FIGS. 3 and 4 above. Rather, only modulo by P, as shown in FIG. 5 may be needed.
FIG. 10 shows a general-purpose computer 100 for obtaining a CRC using process 20 or any of the operations of the CRC generator units 30, 40, 50, 60, 70, 80 and 90 shown above. Computer 100 includes a processor 102 (e.g. a CPU), a storage medium104 (e.g., a random access memory) and communication interface 106 (e.g., a network card) having one or more external connections 106a, 106b and 106c for sending and receiving data transmissions. Storage medium 104 stores computer instructions 108 forobtaining a CRC via process 20 or the operations of the CRC generator units described above. In one embodiment, computer 100 obtains a CRC for a message M based on multiplication by reciprocal approximation.
Process 20 and the operations of the CRC generators shown above, however, are not limited to use with any particular hardware or software configuration; they may find compatibility in any computing or processing environment. Process 20 may beimplemented in hardware, software, or any combination of the two. So too, may the operations of the CRC generator units 30, 40, 50, 60, 70, 80 and 90.
Process 20 and the CRC generators described above may be implemented in computer programs executing on programmable computers that each include a processor, a storage medium readable by the processor (e.g. volatile memory, non-volatile memory,etc.), one or more input devices, and one or more out devices. Program code may be applied to data entered using an input device to perform process 20 or any of the operations of the CRC generators described above. The output information may be appliedto one or more output devices, such as screen 110.
Each such program may be implemented in a high level procedural or object-oriented programming language to communicate with a computer system. However, the programs can be implemented in assembly or machine language. The language may be acompiled or an interpreted language.
Each computer program may be stored on an article of manufacture, such as a CD-ROM, hard disk, or magnetic diskette, that is readable by computer 100 to obtain a CRC for message M in the manners described above. Process 20 and the operations forimplementing the CRC generators above may also be implemented as a machine-readable storage medium, configured with one or more computer programs, where, upon execution, instructions in the computer program(s) cause the processor 102 to operate asdescribed above.
A number of embodiments of the invention have been described. Nevertheless, it will be understood that various modifications may be made without departing from the spirit and scope of the invention. For example, message M may be divided into anodd number of segments or segment sizes or field extensions F may be substituted for generator polynomial P were appropriate. Accordingly, other embodiments are within the scope of the following claims.
* * * * *