示例#1
0
 def test_reveal(self):
     byte = 234213
     hidden_data = 9
     number_of_bad_bits = 15
     bad_byte = byte_tools.hide_data(byte, hidden_data, number_of_bad_bits)
     released_data = byte_tools.reveal_data(bad_byte, number_of_bad_bits)
     self.assertEqual(hidden_data, released_data)
示例#2
0
 def _iter_hidden_bits(self, order_num, number_of_bad_bits=1):
     sample_num = 0
     sample_id = 0
     order_inspector = ORDER_INSPECTORS[order_num](self.container_space())
     while sample_num != self.container_space():
         bits = byte_tools.reveal_data(self[sample_id], number_of_bad_bits)
         for pos in bin(bits)[2:].rjust(number_of_bad_bits, '0'):
             yield int(pos)
         sample_num += 1
         sample_id = order_inspector.next()