Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Memblock file encryption / decryption method help

Author
Message
Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Dec 2011 04:54
I'm working on the beginnings of a file encrypter / decrypter.
I've got the encryption process to work seemingly fine.
The decryption process works OK for text files.
I tried to do a jpeg and it came out shifted and discolored.
There's the same number of bytes in the original file and the decrypted file.
The program just splits a file in two, rearranges the chunks, then puts them back together.

I'm not sure why the jpeg gets messed up and the text file is fine.
Any clues?

(see attachment for the decrypted jpg)

Code can likely be skipped over until the DecryptFile() function, though there may be an issue with how I'm placing the header (which contains the location of the file split). Information on that is in the EncryptFile() function.



Thanks for the help!

Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Dec 2011 15:03
OK I found the issue. Apparently I was skipping a byte when recombining the two files. Not sure why it worked with a txt file that way, maybe I had a space at the end or something...

I really tried to work this out before posting and, of course, after I post I was able to work it out.
To anyone who plans to work on files by the bytes:
Check out BinViewer http://www.gbresearch.com/binviewer/

It saved me from trashing this project and helped me locate the missed byte. I was using the free version, but due to its helpfullness I coughed up the $8.50 USD for the pro license.



Login to post a reply

Server time is: 2026-07-11 17:26:49
Your offset time is: 2026-07-11 17:26:49