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

Function encrypt_message

ciphers/rsa_cipher.py:39–47  ·  view source on GitHub ↗
(
    message: str, key: tuple[int, int], block_size: int = DEFAULT_BLOCK_SIZE
)

Source from the content-addressed store, hash-verified

37
38
39def encrypt_message(
40 message: str, key: tuple[int, int], block_size: int = DEFAULT_BLOCK_SIZE
41) -> list[int]:
42 encrypted_blocks = []
43 n, e = key
44
45 for block in get_blocks_from_text(message, block_size):
46 encrypted_blocks.append(pow(block, e, n))
47 return encrypted_blocks
48
49
50def decrypt_message(

Callers 1

Calls 2

get_blocks_from_textFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected