Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Handling large files in encryption prog

Reply
Thread Tools

Handling large files in encryption prog

 
 
BrianJones
Guest
Posts: n/a
 
      07-23-2004
I'm currently writing an encryption program designed to read in a file (and
encrypt it) by splitting it in to 128 byte block segments and encrypting
each segment iteratively. The problem is is that it works fine up to sizes
of approx 8.5MB (albeit the program slows down throughout the process) and
then crashes at 8.5 leaving me to have to reboot my computer (linux).

Here is the pseudo-code:

whilst not eof
{
read in 128 bytes from file, stick in to inBytes[]
encrypt inBytes[], stick reult in to outBytes[];
write outBytes to disk[];

iterate put stream pointer by 128;
iterate get stream pointer by 128;
}// end of encryption process

delete[] inBytes;delete[] outBytes;

Do you think its a memory (de)allocation issue with inBytes and outBytes. If
so, does any one have any suggestions how I can sort it out?

Thanks
Ben


 
Reply With Quote
 
 
 
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      07-23-2004
BrianJones wrote:
>
> I'm currently writing an encryption program designed to read in a file (and
> encrypt it) by splitting it in to 128 byte block segments and encrypting
> each segment iteratively. The problem is is that it works fine up to sizes
> of approx 8.5MB (albeit the program slows down throughout the process) and
> then crashes at 8.5 leaving me to have to reboot my computer (linux).
>
> Here is the pseudo-code:


pseudo code is of no use in diagnosing a problem in your real code.

The fact that your program slows down is an inidcation that something
is wrong. My guess would be: the encrypt function allocates memory which is
never released. Thus memory leaks get bigger over time and eventually your
program runs out of memory. But that's just a guess.

--
Karl Heinz Buchegger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      07-23-2004

"BrianJones" <(E-Mail Removed)> wrote in message
news:cdqt0o$pvu$(E-Mail Removed)...
> I'm currently writing an encryption program designed to read in a file

(and
> encrypt it) by splitting it in to 128 byte block segments and encrypting
> each segment iteratively. The problem is is that it works fine up to sizes
> of approx 8.5MB (albeit the program slows down throughout the process) and
> then crashes at 8.5 leaving me to have to reboot my computer (linux).
>
> Here is the pseudo-code:
>
> whilst not eof
> {
> read in 128 bytes from file, stick in to inBytes[]
> encrypt inBytes[], stick reult in to outBytes[];
> write outBytes to disk[];
>
> iterate put stream pointer by 128;
> iterate get stream pointer by 128;
> }// end of encryption process
>
> delete[] inBytes;delete[] outBytes;
>
> Do you think its a memory (de)allocation issue with inBytes and outBytes.

If
> so, does any one have any suggestions how I can sort it out?


Well I wonder why you are allocating memory at all, 128 bytes is small
enough that you should just declare those arrays on the stack.

What does

iterate put stream pointer by 128;
iterate get stream pointer by 128;

mean? You are reading and writing files sequentially, there is no need to
adjust the get or put positions. If that is what you are doing then I would
think that could cause a big slow down in your program.

If that doesn't help I suggest you post some real code.

john


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which hard drive encryption program has the strongest tested encryption & security? =?iso-8859-1?Q?-=3D|__=28=BAL=BA=29__|=3D-____o=3D=5B:::::::::::::::=BB?= Computer Security 6 02-20-2008 01:35 PM
Starting and stopping a prog. from another prog. andoni.oconchubhair@ie.fid-intl.com Java 1 10-22-2006 10:43 PM
Handling large files > 4 GB Michael C++ 3 06-23-2004 07:02 PM
Large files handling boomer XML 1 11-10-2003 02:00 AM
Backing Up Large Files..Or A Large Amount Of Files Scott D. Weber For Unuathorized Thoughts Inc. Computer Support 1 09-19-2003 07:28 PM



Advertisments