Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def set_errorsP1(encoded):
  2.     """
  3.    Допустить ошибку в блоках бинарных данных
  4.    """
  5.     result = ''
  6.     for chunk in chunk_iterator(encoded, CHUNK_LENGTH + len(CHECK_BITS)):
  7.         num_bit = random.randint(1, len(chunk))
  8.         chunk = '{0}{1}{2}'.format(chunk[:num_bit - 1], int(chunk[num_bit - 1]) ^ 1, chunk[num_bit:])
  9.         result += (chunk)
  10.     return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement