2017-07-13 215 views
0

我有一個無法解決的多項式CRC。CRC計算卡住

X^5 + X^2 + 1

數據:1011100110001

我不喜歡這樣的:

100101 | 1011100110001 
     100101 
     ------- 
     0010110 
      000000 
      ------ 
      101101 
      100101 
      ------ 
      010001 
      000000 
      ------ 
      100010 
      000000 <- I wrote here 0's because 100101 > 100010 
      ------ 
      1000100 
       100101 
      ------- 
      1100001 <- Here is the problem! It's more than 5 bits. 

這有什麼錯我的計算?

回答

0

我不明白你的「000000」行,但這個怎麼樣:

Input data: 1011100110001 
Polynom: 100101 (n = 6) 

101110011000100000 <- expand input data by n-1 zeros 
100101    <- polynom aligned to most left 1 of input data 
-------- 
00101101   <- input XOR polynom, then get next input bit 
    100101    
    ------    
    00100010   <- and so on... 
    100101 
    ------- 
    000111001 
     100101 
     ------ 
     0111000 
     100101 
     ------ 
     0111010 
     100101 
     ------ 
     0111110 
      100101 
      ------- 
      0110110 
      100101 
      ------ 
      0100110 
      100101 <- ... until all input bits are "used up" 
      ------ 
      000011 <- CRC result 
+0

爲什麼你做的「等」行?我看到你從數據中添加了多個數字,這些數字對於XOR來說不夠用,但我認爲所有的結果都小於我們添加的分隔符 –