Gray Code



I am working my way through CRC32, and one implementation of CRC32 uses
Gray coding or reflected coding. Actually, upon examination, it looks
like openSSH uses Gray coding in it's CRC32 implementation.

Where I am stuck is with the binary math and the difference between 1,
2, and 4 bit reflections.

If I have the following , what would be it's 1, 2, and 4 bit
reflections?

1010-1111-0011

My understandings is that I XOR the right shifted value by the number
of bits:

1010-1111-0011 (n)
0101-0111-1001 (n >> 1)
----------------------
1111-1000-1010

So the above in C is:

n ^ ( n >> 1)

Is the above correct?

Also, what is meant by 1, 2, and 4 bit reflections? Am I shifting by
that many bits? I am not quite sure.

Thanks!

.



Relevant Pages

  • Gray Binary Coding
    ... I am working my way through CRC32, and one implementation of CRC32 uses ... like openSSH uses Gray coding in it's CRC32 implementation. ... 2, and 4 bit reflections. ...
    (comp.programming)
  • Re: Gray Code
    ... 2 and 4-bit reflections. ... This can be done by shifting the bits from one register to another. ... like openSSH uses Gray coding in it's CRC32 implementation. ... My understandings is that I XOR the right shifted value by the number ...
    (comp.theory)