forked from itec/banana
translated
This commit is contained in:
parent
989f3820a7
commit
f18d1fdc68
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue