Need help with python.

Status
This thread has been locked.

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
Hi, please don't message if you don't know because I don't really have time. I need people to work out why I get strange characters that aren't letters when the following code is executed, its python code and it is an attempt of the vigenere cipher that takes in your message and keyword.
Please help :)


 
Banned forever. Reason: Account compromised

Chearful

thomas.gg
Supreme
Feedback score
115
Posts
1,399
Reactions
2,236
Resources
0

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
It's okay, I have found a solution but thanks anyway ;)
 
Banned forever. Reason: Account compromised

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
  1. if newchar>ord("Z"):
  2. newchar-=26
I think that if statement is a problem. For example, if newchar is more than 90 (which is Z in decimal form) you are subtracting 26. However, that might not be a character on the ASCII table since it goes upto 127 (They are in the ASCII Table but as the "weird" characters that you are getting. :)). "newchar" can be 233 and you subtract 26 which gives 207, which is not in the ASCII table. This seems to be the case because when I print the value for "newchar" I get these:


190
177
177
192
175
179

None are in the ASCII Table. I'll try prepare a solution for you if you'd like?


Definitely, please do!
 
Banned forever. Reason: Account compromised

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
I just put the code into pastebin and then added the pastebin link to the thread and it generated it.
 
Banned forever. Reason: Account compromised

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
Ah! Here's the code! :)

Removed the print(newchar) at line 22. It was for debugging purposes.

[DOUBLEPOST=1462990051][/DOUBLEPOST]Did this solution work, Lewis?


Hi,
thanks, it seems to translate to letters. But I was also having a look online at solutions and I can't remember what it was, I changed some number and it seemed to work. I tried translating the word "hello" with the key "hi" and my program translated to "omstv", i tried to find an online vigenere cipher to see if mine was the same and it was (http://planetcalc.com/2468/)
So i'm confused, which is right, mine or yours? Because mine had the same result as the online calculator.
 
Banned forever. Reason: Account compromised
Status
This thread has been locked.
Top