Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private uint modeS_Parity112bit(byte[] src)
- {
- if (src.Length != 11)
- {
- throw new Exception("length of data is not correct");
- }
- UInt32 poly = 0xfffa0480;
- UInt32 data = (UInt32)((src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]));
- UInt32 data1 = (UInt32)((src[4] << 24) | (src[5] << 16) | (src[6] << 8) | (src[7]));
- UInt32 data2 = (UInt32)((src[8] << 24) | (src[9] << 16) | (src[10] << 8));
- int i = 0;
- while (i < 88)
- {
- if ((data & 0x80000000) != 0)
- {
- data = data ^ poly;
- }
- data = data << 1;
- if ((data1 & 0x80000000) != 0)
- {
- data = data | 1;
- }
- data1 = data1 << 1;
- if ((data2 & 0x80000000) != 0)
- {
- data1 = data1 | 1;
- }
- data2 = data2 << 1;
- i++;
- }
- return Convert.ToUInt32((data & 0xffffff00) >> 8);
- }
Advertisement
Add Comment
Please, Sign In to add comment