MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / decrypt_message

Function decrypt_message

ciphers/rsa_cipher.py:50–60  ·  view source on GitHub ↗
(
    encrypted_blocks: list[int],
    message_length: int,
    key: tuple[int, int],
    block_size: int = DEFAULT_BLOCK_SIZE,
)

Source from the content-addressed store, hash-verified

48
49
50def decrypt_message(
51 encrypted_blocks: list[int],
52 message_length: int,
53 key: tuple[int, int],
54 block_size: int = DEFAULT_BLOCK_SIZE,
55) -> str:
56 decrypted_blocks = []
57 n, d = key
58 for block in encrypted_blocks:
59 decrypted_blocks.append(pow(block, d, n))
60 return get_text_from_blocks(decrypted_blocks, message_length, block_size)
61
62
63def read_key_file(key_filename: str) -> tuple[int, int, int]:

Callers 1

Calls 2

get_text_from_blocksFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected