(bytes_obj, sudoku_key, boot_strap)
| 442 | # boot_strap |
| 443 | # - should be a proper "markov" bootstrap |
| 444 | def decrypt(bytes_obj, sudoku_key, boot_strap): |
| 445 | _check_sudoku_key(sudoku_key) |
| 446 | _check_boot_strap(boot_strap, sudoku_key) |
| 447 | # make byte_map |
| 448 | array = sorted(sudoku_key[0]) |
| 449 | byte_map = dict((byte, value) for value, byte in enumerate(array)) |
| 450 | # create two more arguments for decode |
| 451 | grid = make_grid(sudoku_key) |
| 452 | grid = make_decode_grid(grid, len(sudoku_key[0])) |
| 453 | index = list(map(byte_map.__getitem__, boot_strap)) |
| 454 | # run the actual decoding algorithm and create reversed map |
| 455 | code, index = _decode(bytes_obj, byte_map, grid, index, len(sudoku_key[0])) |
| 456 | rev_map = dict(reversed(item) for item in byte_map.items()) |
| 457 | # fix the boot_strap and return the results |
| 458 | boot_strap = bytes(rev_map[number] for number in index) |
| 459 | return code, boot_strap |
| 460 | |
| 461 | # string |
| 462 | # - should be the string that you want decoded |
no test coverage detected