Ejemplo n.º 1
0
    def testOutputAllLfsr(self):
        state = tp1.getState1(2015686042)
        output = 0

        for i in range(40):
            outputLfsr, state = tp1.update_LFSR(state, tp1.getlfsr1()[1], tp1.getlfsr1()[0])
            output ^= outputLfsr << i

        self.assertEqual(output, int("0101100110100010001011010010111010011000"[::-1], 2))

        state = tp1.getState2(2015686042)
        output = 0

        for i in range(40):
            outputLfsr, state = tp1.update_LFSR(state, tp1.getlfsr2()[1], tp1.getlfsr2()[0])
            output ^= outputLfsr << i

        self.assertEqual(output, int("1101110010011100101111001011100111101100"[::-1], 2))

        state = tp1.getState3(2015686042)
        output = 0

        for i in range(40):
            outputLfsr, state = tp1.update_LFSR(state, tp1.getlfsr3()[1], tp1.getlfsr3()[0])
            output ^= outputLfsr << i

        self.assertEqual(output, int("1000001111001101011010101001100110011011"[::-1], 2))
Ejemplo n.º 2
0
 def testLfsrState(self):
     self.assertEqual(410, tp1.getState1(2015686042))
     self.assertEqual(315, tp1.getState2(2015686042))
     self.assertEqual(961, tp1.getState3(2015686042))