Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed error with encryption shifting #2

Merged
merged 2 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions enyo/enyodecryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def __init__(self,text,secret,partition=2):
self.decrypted = self.decode(self.decryption()) # Multistage XOR Decryption + Decoding

def encode(self,str):
bits = ""
encodedWord = ""
bits = ""
# Converting the ascii characters to binary
for i in str:
bits += format(ord(i),'08b')
Expand All @@ -28,8 +28,8 @@ def encode(self,str):
return encodedWord

def decode(self,str):
decodedWord = ""
bits = ""
decodedWord = ""
# Converting the ASCII values to fit in our character set.
for i in str:
if(ord(i)>64 and ord(i)<91):
Expand Down Expand Up @@ -127,8 +127,8 @@ def sequenceGenerator(self,key):

def transpositionDecryption(self,encrypt):
decrypted = ""
size = self.findMatrixSize(encrypt) #Dimension of transposition matrix
matrix = []
size = self.findMatrixSize(encrypt) #Dimension of transposition matrix
# Initializing matrix
for i in range(size):
temp = []
Expand Down Expand Up @@ -156,8 +156,8 @@ def transpositionDecryption(self,encrypt):
return encrypt

def decryption(self):
index = 0
decrypted = ""
index = 0
for i in range(len(self.encrypted)):
x = self.newCharSet[self.encrypted[i]]
j = len(self.key)-1
Expand Down
2 changes: 1 addition & 1 deletion enyo/enyoencryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ def encryption(self):
index += 1
if(index>len(self.key[0])-1):
index = 0
return encrypted
return encrypted