1
0
Fork 0
forked from itec/banana

translated

This commit is contained in:
itec 2020-10-29 16:23:12 +01:00
parent 989f3820a7
commit f18d1fdc68

View file

@ -40,14 +40,14 @@ class Codec:
numalpha = len(alphabets)
if (len(word) - self.alphaend) % numalpha != 0:
raise ValueError("Banana non valida")
raise ValueError("Invalid banana")
v = 0
for i in range(len(word)):
r = (numalpha + i + self.shiftalpha) % numalpha
try:
v = v * len(alphabets[r]) + alphabets[r].index(word[i])
except (ValueError, KeyError):
raise ValueError("Carattere non valido in posizione %d" % i + 1)
raise ValueError("Invalid character in position %d" % i + 1)
return v