Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pycipher/foursquare.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self,key1='zgptfoihmuwdrcnykeqaxvsbl',key2='mfnbdcrhsaxyogvituewlqz
def encipher_pair(self,a,b):
arow,acol = self.alph.index(a)/5, self.alph.index(a)%5
brow,bcol = self.alph.index(b)/5, self.alph.index(b)%5
return (self.key1[arow*5+bcol], self.key2[brow*5+acol])
return (self.key1[int(arow*5)+bcol], self.key2[int(brow*5)+acol])

def decipher_pair(self,a,b):
arow,acol = self.key1.index(a)/5, self.key1.index(a)%5
Expand All @@ -42,7 +42,7 @@ def encipher(self,string):
:param string: The string to encipher.
:returns: The enciphered string.
"""
string = self.remove_punctuation(string)
string = self.remove_punctuation(string)
if len(string)%2 == 1: string = string + 'X'
ret = ''
for c in range(0,len(string.upper()),2):
Expand Down Expand Up @@ -70,4 +70,4 @@ def decipher(self,string):
return ret

if __name__ == '__main__':
print('use "import pycipher" to access functions')
print('use "import pycipher" to access functions')