CRC. A CRC polynomial is a boolean list or an integer.
The following CRC polynomials p and q are equivalent:
p=: 1 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0
q=: _306674912
_8]\p
1 1 1 0 1 1 0 1
1 0 1 1 1 0 0 0
1 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0
q -: (_2 _2,30$2) #. p
1
p -: (32$2) #: q
1
x 128!:3 y computes the CRC encoding of string y
according to x , which
may be p or p;i , where p
is a CRC polynomial and i is the initial CRC value.
If i is elided then _1 is used. 128!:3 y
is equivalent to _306674912 (128!:3) y .
The monad x&(128!:3) is supported by special code which
pre-computes a look-up table of CRC values for each byte.
Examples:
f=: 128!:3
f '123456789'
_873187034
f 'assiduously avoid any and all asinine alliterations'
1439575093
|