• Post Reply Bookmark Topic Watch Topic
  • New Topic

Decrypting RC4  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day Pros,

Please, I have a project to encrypt a given string with RC4 and decrypt it back to it's original text with Java.
I have been able to encrypt but I need your guide in decrypting the code.

My code is below:



Thank you.
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abiodun Sulaiman wrote:
Please, I have a project to encrypt a given string with RC4 and decrypt it back to it's original text with Java.
I have been able to encrypt but I need your guide in decrypting the code.


Well, assuming that the purpose is to encrypt the value in the "input" variable, and you want to get that value back via decrypt... your encryption algorithm doesn't do much with the input variable. It does extract it to a fullcode variable, and it does print it. However, it does nothing else with the input variable. It also does nothing else with the fullcode variable. And the fullcode variable went out of scope upon completion of the PRGA() method call.

In other words, where is the encrypted text stored? ... as by the time encryption finished, every variable that you defined, are either out of scope, or can't have any possibility of holding anything remotely related to the value in the "input" variable.

Henry
 
Abiodun Sulaiman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Well, assuming that the purpose is to encrypt the value in the "input" variable, and you want to get that value back via decrypt... your encryption algorithm doesn't do much with the input variable. It does extract it to a fullcode variable, and it does print it. However, it does nothing else with the input variable. It also does nothing else with the fullcode variable. And the fullcode variable went out of scope upon completion of the PRGA() method call.
In other words, where is the encrypted text stored? ... as by the time encryption finished, every variable that you defined, are either out of scope, or can't have any possibility of holding anything remotely related to the value in the "input" variable.

Henry


Thanks Henry.

The encrypted variable can be assessed by calling the PRGA(); and I could actually store it in a string variable, like

I, then, need to decrypt the variable . When I could not decrypt, I just printed it out with the method , but that doesn't replace decryption.

So, please, can you point me in the right direction with decrypting the variable?

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!