Mam program v Pythone, ktory by mal riesit sifrovanie Vigenere ale abeceda je ABCČDEFGHCHIJKLMNOPRŘSŠTUVXYZŽ, pricom CH je pismeno, a malo by sa brat ako jeden znak.
Vyslo mi zatial nieco taketo:
# Czech Vigenere cipher - Ch is '+' character
CHARSET = 'ABCČDEFGH+IJKLMNOPRŘSŠTUVXYZŽ'
def main():
message = input('Message to encrypt: ')
key = input('Encryption key: ').upper()
encrypted = []
index = 0
for character in message:
current = CHARSET.find(character.upper())
if current != -1:
current += CHARSET.find(key[index])
current %= len(CHARSET) - 1
encrypted.append(CHARSET[current + 1].upper())
index += 1
if index == len(key):
index = 0
else:
key = encrypted
print('Input: %s' % message)
print('Output: %s' % ''.join(encrypted))
if __name__ == '__main__':
main()
Sprava: programujte
Kluc: pythonpytho
Sifra: gojogodšfčt