feat: key will repeat over every characters even if it isn't in alphabet
This commit is contained in:
parent
696c37396b
commit
252ff429d2
@ -15,10 +15,9 @@ class VigenereCipher(object):
|
||||
|
||||
pos = (text_pos + key_pos) % len(self.alphabet)
|
||||
encoded.append(self.alphabet[pos])
|
||||
|
||||
idx_key += 1
|
||||
else:
|
||||
encoded.append(char)
|
||||
idx_key += 1
|
||||
|
||||
return "".join(encoded)
|
||||
|
||||
@ -34,9 +33,8 @@ class VigenereCipher(object):
|
||||
|
||||
pos = (text_pos - key_pos) % len(self.alphabet)
|
||||
decoded.append(self.alphabet[pos])
|
||||
|
||||
idx_key += 1
|
||||
else:
|
||||
decoded.append(char)
|
||||
idx_key += 1
|
||||
|
||||
return "".join(decoded)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user