Advertising (This ad goes away for registered users. You can Login or Register)

Encryption/Decryption GUI (Fixed 0.1)

Programming on your favorite platform, for your favorite platform? Post here
Post Reply
dj51_Shura
Posts: 36
Joined: Thu Jun 16, 2011 7:35 pm
Location: Granada, Spain
Contact:

Encryption/Decryption GUI (Fixed 0.1)

Post by dj51_Shura » Sun Oct 16, 2011 6:16 pm

Hello everyone! After "learning" some C and have a lot of errors (xD), I'm pleased to presentate you my first graphical user interface, the Encryption/Decryption GUI. This program is designed to easyly allow you to encrypt and decrypt files using a lineal algorithm.

I have used the functions defined in my IO Utilities Library, as ioEncrypt() and ioDecrypt(). Of course, I want to thank to m0skit0 and Stobby, who helped me when I have problems with the encryption functions.

A screenshot of the "Files" tab:
Image

It has developped in C, with the wonderfull Gtk library, and using the gcc compiler. I'm using Debian GNU/Linux "squeeze", and it works perfectly (with the issues described down-scrolling, but fine). I want to compile a .exe file for Windows users, but, first, I need to adapt some functions and font descriptors.

.zip package from mediafire: http://www.mediafire.com/?whkkzxymzgr4xr3
The IO Utilities Library (source&doc): http://www.mediafire.com/?flg9j0wu98u9v0m
*** Open source, licensed under the GNU General Public License v3 ***

The previous issues with large files are solved (thanks to Codestation and m0skit0 another time) and I'm working at the log minimal problems. I want to port it to Windows...

The use is too simple: just select an input file, change the output path if you want (because it's auto-filled by the program), and run. The mode and the check-box "Overwrite itself" are optional tags to manage the output. If you check that checkbox, the application will overwrite the original file, but, be carefull with this option, overcoat with large files.

Thank you for reading and, in some cases, for downloading ;)
Advertising
Last edited by dj51_Shura on Mon Oct 17, 2011 8:10 pm, edited 3 times in total.
PSP 6.20 PRO-B7 and TN HEN E Fix firmware

http://www.mhypnok.blogspot.com

User avatar
codestation
Big Beholder
Posts: 1660
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: Encryption/Decryption GUI

Post by codestation » Sun Oct 16, 2011 6:28 pm

Moving it to PC -> programming as this isn't PSP related.

Just a suggestion, remove those filler comments, its very hard to read the code with those /* >>> */ /* >>> */ /* >>> */ /* >>> */ around.
The application has some issues; for example, if you want to encrypt or decrypt a large file, the application will... mmm... very, very slow.
Try to read/write more bytes into each read/write call. For example you could read 4KiB at a time, do your encryption/decryption in that buffer then write the whole block in the output file. Your actual bottleneck is the lots of read/write functions and if you reduce those then the whole process is gonna go "A LOT" faster.
Advertising
Plugin list
Working on: QPSNProxy, QCMA - Open source content manager for the PS Vita
Playing: Error: ENOTIME
Repositories: github, google code
Just feel the code..

dj51_Shura
Posts: 36
Joined: Thu Jun 16, 2011 7:35 pm
Location: Granada, Spain
Contact:

Re: Encryption/Decryption GUI

Post by dj51_Shura » Sun Oct 16, 2011 6:32 pm

Codestation wrote:
Moving it to PC -> programming as this isn't PSP related.
Oh sorry... my fault >.< (I was accustomed to post in PSP topic...)

Thank you
PSP 6.20 PRO-B7 and TN HEN E Fix firmware

http://www.mhypnok.blogspot.com

User avatar
Disturbed0ne
Retired Mod
Posts: 3787
Joined: Sun Jan 16, 2011 5:44 am
Location: In a van, down by the river!
Contact:

Re: Encryption/Decryption GUI

Post by Disturbed0ne » Sun Oct 16, 2011 6:41 pm

Congrats on writing your first program. :D

P.S. Did you mean to link to just the folder this is in?

Here is the direct link for this "Encryption/Decryption GUI"
DO NOT MESSAGE ME ABOUT THE NAME OF ANY NINJA RELEASE GAME! I WILL NOT PROVIDE YOU WITH THE NAME OF THE GAME AND IF YOU PERSIST THEN I WILL REPORT YOU TO THE STAFF!
I AM A RETIRED MODERATOR!

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Encryption/Decryption GUI

Post by m0skit0 » Mon Oct 17, 2011 4:08 pm

Excellent, really nice! ;)
codestation wrote:Moving it to PC -> programming as this isn't PSP related.
Hmmmm this is questionable as it definitely DOES relate to PSP. But it's PC programming :mrgreen:
codestation wrote:Try to read/write more bytes into each read/write call. For example you could read 4KiB at a time, do your encryption/decryption in that buffer then write the whole block in the output file. Your actual bottleneck is the lots of read/write functions and if you reduce those then the whole process is gonna go "A LOT" faster.
I was just going to say this. I/O is usually the slowing down part for every software. Try to do the minimum calls to I/O functions as possible. Write/read everything to buffers in memory, then flush to files. Keep in mind modern computers have A LOT of RAM, so don't be shy using hundreds of MiBs if needed. Personally I would load the whole file into RAM and work from there (you can always do some checks about the size, but homebrews usually won't be that big).

Keep the good work going!
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

dj51_Shura
Posts: 36
Joined: Thu Jun 16, 2011 7:35 pm
Location: Granada, Spain
Contact:

Re: Encryption/Decryption GUI

Post by dj51_Shura » Mon Oct 17, 2011 7:00 pm

Thanks all of you!

I will modify the encryption functions as Codestation and m0skit0 suggest to me, to work with arrays and not with single chars (xD).
Codestation wrote:
Just a suggestion, remove those filler comments, its very hard to read the code with those /* >>> */ /* >>> */ /* >>> */ /* >>> */ around.
Oh... about it, the code (for me) it's more hard to read without those /* >>> */. Those comments are ussed to structurate the code in sections, subsections... etc...
For example, if I have a button inside a tab, then in the code, the button definition, set of its parameters... will be under the tab page definitions... you can take note about this in almost all code in main.c.
Codestation wrote:
Try to read/write more bytes into each read/write call. For example you could read 4KiB at a time, do your encryption/decryption in that buffer then write the whole block in the output file. Your actual bottleneck is the lots of read/write functions and if you reduce those then the whole process is gonna go "A LOT" faster.
m0skit0 wrote:
I was just going to say this. I/O is usually the slowing down part for every software. Try to do the minimum calls to I/O functions as possible. Write/read everything to buffers in memory, then flush to files. Keep in mind modern computers have A LOT of RAM, so don't be shy using hundreds of MiBs if needed. Personally I would load the whole file into RAM and work from there (you can always do some checks about the size, but homebrews usually won't be that big).
All functions adapted. It required some time... but time well spent ^.^

Now the GUI can work with files larger than some kilobytes (xD), like the ISO of Debian "squeeze" that I used to install it in my laptop (I keep it), of 168 MB aprox, in some seconds. The issues is, now, in the log (working to solve) and in the "buffers" tab. Also, I try to make buffers largers than 2 MB, but can't! Segmentation fault! WTF!? Well, I need to look it well...

Thanks all of you,
best regards!
PSP 6.20 PRO-B7 and TN HEN E Fix firmware

http://www.mhypnok.blogspot.com

Post Reply

Return to “Programming”