owendaigle / SCtechEncrypterDecrypter

Sugarcane Tech encrypter and decrypter program. Very basic
0 stars 0 forks source link

[QUESTION] Questioning line 12 code of needthis.py #4

Closed TheTechRobo closed 3 years ago

TheTechRobo commented 3 years ago

I'm questioning this code:

if encodedText[i] != 32

Why can't it be 32?

owendaigle commented 3 years ago

I dont remember exactly why, but I think it had something to do with the fact that the character bound to the ascii code 32 was something that it did not decode for some reason??? I dont remember exactly why. And I cant find it in the file on github.

TheTechRobo commented 3 years ago

It seems to work without it.

>>> test = encryptVer1(" ")
>>> def decryptVer1(text): #for Decryption
     """
     This is one of the ways text can be decrypted.
     Syntax: decryptVer1(encrypted_text)
     """
     decodedText = list(text)
     length = len(decodedText)
     for i in range(0,length):
         decodedText[i] = ord(decodedText[i])
         decodedText[i] = decodedText[i] + 8
         decodedText[i] = str(chr(decodedText[i]))
     decodedText = ''.join(decodedText)
     return decodedText
>>> decryptVer1(test)
' '
owendaigle commented 3 years ago

I think it stopped working when you put a certain character. I think it was the one with ascii code 24

owendaigle commented 3 years ago

or whatever 32 minus the moderator was, or maybe the one with ascii code 32?? I dont remember. It was just having something to do with the ascii code 32

TheTechRobo commented 3 years ago

It was 24. And it seems to decrypt fine.

If you think of it, could you tell me the answer? Thanks :) (it would make the code even more unbreakable)

TheTechRobo commented 3 years ago

OK, for now I'm going to keep it this way, but again, tell me if you know the answer. :slight_smile:

TheTechRobo commented 3 years ago

Question answered (now I understand, because I just had to do something similar)