Skip to content

Instantly share code, notes, and snippets.

View alex-pancho's full-sized avatar
🎓
nav4it

panix alex-pancho

🎓
nav4it
  • Ukraine
View GitHub Profile
@alex-pancho
alex-pancho / vigenere-cipher.py
Created December 31, 2019 00:34 — forked from gowhari/vigenere-cipher.py
vigenere cipher
# encoding: utf8
# vigenere cipher
# https://stackoverflow.com/a/2490718/1675586
def encode(key, string):
encoded_chars = []
for i in range(len(string)):
key_c = key[i % len(key)]
encoded_c = chr(ord(string[i]) + ord(key_c) % 256)
encoded_chars.append(encoded_c)