Peter Coghlan cctalk at
Sun Jan 26 17:05:57 CST 2020

Mattis Lind wrote:

> Hello IBM BSC Experts!
> I am trying to figure out the CRC algorithm used by IBM BSC. I have tried a
> lot of different settings in crcreveng but not getting a match.

I'm definately not an IBM BSC Expert and I don't even play one on TV.  I have
tweaked some BSC emulation code written by someone else so I have some vague
idea about this stuff, however, the emulation did not include CRCs so I'm
not sure how much help I can be.

> I am pretty convinced that the CRC-16 used by IBM was
>   16          15       2
> x      +   x     +   x     +  1

In the file bcb_crc.c supplied with the funetnje and HUJI-NJE packages, it
says the following (which may or may not relate to CRCs in the BSC world):

 | The generating polynomial is X^16+X^15+X^2+1 (CRC-16). When computing the
 | CRC, DLE's are not computed (except from a second DLE in a sequence of
 | 2 DLE's). Furthermore, the first DLE+ETB which starts a text block is
 | not computed also.

There is also some code for checking CRCs, however, it is not clear to me
if this code is for use with BSC lines or with DECnet lines.

> This would give the polynomial 8005.
> Anyone against this statement?
> But what was the initial value?
> I have two actual messages from equipment employing IBM BSC:
> 32016CD90240404070032688
> and
> 32016CD90240C84050030D28

These appear to be something like:

SYN SOH '%' 'R' STX SP SP SP ACK0 ETX followed by CRC-16


SYN SOH '%' 'R' STX SP 'H' SP '&' ETX followed by CRC-16

> From this document (
> )
> I get that the CRC calculation is reset on SOH (01h) or STX (02h) and
> accumulates until and including the ETX (03h). (excluding any SYN (32h)
> characters).

On page 17, it seems to suggest that the CRC calculation is not reset by STX
when the STX follows SOH, which it does in the above cases.

> I have tried crcreveng back and forth and I am not getting the CRC bytes
> right.
> I think I have tried most things, different bit order, different initial
> values. But nothing.
> I also tried the mode in crcreveng where it searches for matches but it
> always says "no models found". Maybe I am doing something wrong when using
> crcreveng?
> Any clues? Surely there are someone out there that has been around for some
> time and knows this, right?

On page 8, it says: "SOH% is presently used to identify request-for-test or
station-dependent control messages." - could this be significant?

What produced the the two sequences you quoted above and do you know what
those messages mean?  Is it possible that the CRC included with them is
deliberately wrong?

Peter Coghlan.

More information about the cctech mailing list