Okay. I have encrypt and decrypt file done. Let start at being I ask user for key and what file what they want to read or encrypt. And encrypt. For decrypt it same code. Now i have problem at let say the user enter 5 for key. How can i write code that find the key and understand that file is not encrypt any more . Anyone? I try for if while dowhile
My_1
0
Light Poster
Recommended Answers
Jump to PostWhat key??? Why do you need to find the key? If your encryption algorithm takes in a key, it should use the key in the encryption process. If one wants to decrypt and give a wrong key, the content from decryption should be garbage anyway.
The decision to encrypt/decrypt should …
Jump to PostIf there are only 256 possible keys, just try each one in a loop until you get one that works.
Jump to PostYou will need to know something about the file so you can see if it decrypted correctly.
Many file types have a standard header ("magic number") at the start, eg pdf files start "%PDF", so you can look for that.
If you know it's an English text file then the …
Jump to PostJava chars are 16 bit UniCode, ans include Hebrew, Arabic, Chinese... all kinds of symbols.
Ordinary English text can be encoded in just 7 bits (values 0 - 127 or 7f) using the ASCII codes. Java UniCode is the same as ASCII for up to 127 (hex 7f).
All 16 Replies
Taywin
312
Posting Virtuoso
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
My_1
0
Light Poster
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
My_1
0
Light Poster
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
My_1
0
Light Poster
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
My_1
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.