MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __encrypt_part

Function __encrypt_part

ciphers/trifid_cipher.py:23–37  ·  view source on GitHub ↗

Arrange the triagram value of each letter of `message_part` vertically and join them horizontally. >>> __encrypt_part('ASK', TEST_CHARACTER_TO_NUMBER) '132111112'

(message_part: str, character_to_number: dict[str, str])

Source from the content-addressed store, hash-verified

21
22
23def __encrypt_part(message_part: str, character_to_number: dict[str, str]) -> str:
24 """
25 Arrange the triagram value of each letter of `message_part` vertically and join
26 them horizontally.
27
28 >>> __encrypt_part('ASK', TEST_CHARACTER_TO_NUMBER)
29 '132111112'
30 """
31 one, two, three = "", "", ""
32 for each in (character_to_number[character] for character in message_part):
33 one += each[0]
34 two += each[1]
35 three += each[2]
36
37 return one + two + three
38
39
40def __decrypt_part(

Callers 1

encrypt_messageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected