Skip to content

Commit

Permalink
Merge pull request #2 from dxmxnlord/rishi
Browse files Browse the repository at this point in the history
fixed error with encryption shifting
  • Loading branch information
apratimshukla6 authored Sep 30, 2020
2 parents 0a34129 + 1a7f2b5 commit 087192b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 087192b

Please sign in to comment.