> An certain amount of upsizing is expected based on original > plain text size, padding and block sizes.
I would NOT expect ANY upsizing in CTR encryption mode. It is one of plaintext size-preserving modes (OFB and CFB also come to mind). These modes don't (shouldn't) care for either message size of block size. > Perhaps you could create a similar situation by compressing > your text first. In this case, the the compressed text and encrytped > (compressed) text would probably be less than the > uncompressed plain text size. This would work - but the requirement as I read it is to preserve the size, not to increase OR DEcrease. Please try your exact program with *file* source instead, and see if the results are any better. Mine certainy are: $ ll ui-tstc.* -rw------- 1 Mouse None 14633 Oct 17 12:01 ui-tstc.cpp -rw-r--r-- 1 Mouse None 14633 Oct 17 12:32 ui-tstc.dec -rw-r--r-- 1 Mouse None 14633 Oct 17 12:32 ui-tstc.enc $ I'm using Fle Source and Sink, encrypting and then decrypting ui-tstc.cpp file (which is clearly longer than 4096 bytes). Size is preserved across encryption and subsequent decryption, just like one would expect. My opinion is that since "string" is not just a byte array - there is something size-dependent in the type descriptor that accompanies the object (and subsequently gets encrypted?). Regardless, if you want to use memory-based plaintext - use Byte Array or something similar, not "string". > On 10/17/07, eva2002 <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > i am currently working on a project that requires me to parallel > > encrypt a file and decrypt the file as whole. I figured > that I could > > use AES with cipher mode CTR to do it. However in order to get it > > working, I have to get this out plaintext size = ciphertext size. > > > > I tried out a few tests to see how different plaintext size affects > > the ciphertext. > > > > I found out that if input size is greater than 4096, the ciphertext > > size is larger than plaintext size. Is there a way to get the > > ciphertext size to be the same as plaintext size and yet it > can still > > decrypt the file as whole? > > > > CryptoPP::StringSource(plainText, true, new > > CryptoPP::StreamTransformationFilter(Encryptor, new > > CryptoPP::StringSink(CipherText))); > > > > This is what I did. Thanks > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
