Trouble with multialphabetic multi-contour substitution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Trouble with multialphabetic multi-contour substitution

https://code.sololearn.com/c23a17a101a1/?ref=app EN: There is such a program here. The input is given the text for encryption and the key. The key is necessary for the program to read this word by letter and find the id of the letter in the alphabet array, and this number is used to encrypt the letter from the text with one of the other three alphabets. The next letter of the key would give the new id of the letter in the alphabet array, and so on until the entire text is encrypted. The key, if there are fewer letters in it than in the text, must be read again. How do I implement this repeated key read? RU: Имеется такая вот программа. На ввод даётся текст для шифрования и ключ. Ключ необходим, чтобы программа считывала это слово по буквам и находила id буквы в массиве алфавита, и по этому номеру шла шифровка буквы из текста одним из трёх других алфавитов. Следующая буква ключа давала бы новый id буквы в массиве алфавита, и так далее, пока не зашифруется весь текст. Ключ, если букв в нём меньше, чем в тексте

5th Apr 2021, 6:49 PM
PUFFIN Channel
PUFFIN Channel - avatar
1 Answer
0
Without studying your code ... I assume this solution will guide you. When you loop through the key, use a WHILE TRUE. Then inside the while loop, if you reach the end of the key, reset the pointer to the beginning of the key and continue. Then when you reach the end of the text, you use BREAK to escape the loop. You will have to manually increment your key’s index and reset it to 0 whenever you reach len(key). So you keep looping through the key.
5th Apr 2021, 8:41 PM
Jerry Hobby
Jerry Hobby - avatar