(bytes_obj, sudoku_key, boot_strap)
| 370 | # boot_strap |
| 371 | # - should be a proper "markov" bootstrap |
| 372 | def encrypt(bytes_obj, sudoku_key, boot_strap): |
| 373 | _check_sudoku_key(sudoku_key) |
| 374 | _check_boot_strap(boot_strap, sudoku_key) |
| 375 | # make byte_map |
| 376 | array = sorted(sudoku_key[0]) |
| 377 | byte_map = dict((byte, value) for value, byte in enumerate(array)) |
| 378 | # create two more arguments for encode |
| 379 | grid = make_grid(sudoku_key) |
| 380 | index = list(map(byte_map.__getitem__, boot_strap)) |
| 381 | # run the actual encoding algorithm and create reversed map |
| 382 | code, index = _encode(bytes_obj, byte_map, grid, index, len(sudoku_key[0])) |
| 383 | rev_map = dict(reversed(item) for item in byte_map.items()) |
| 384 | # fix the boot_strap and return the results |
| 385 | boot_strap = bytes(rev_map[number] for number in index) |
| 386 | return code, boot_strap |
| 387 | |
| 388 | # string |
| 389 | # - should be the string that you want encoded |
no test coverage detected