Hi all,

previously I posted that I am trying to get some parallel encryption
up. I have tried using AES, CTR mode. After a few tests, I discover
that the current chunk is dependent on the previous chunk data which
does not allow me to make it work in parallel.

Code:
//every thread has a encryptor.
CryptoPP::CTR_Mode< CryptoPP::AES >::Encryption encryptor;
encryptor.SetKeyWithIV( key, sizeof( key ), iv );

// start parallelize
while (!EOF)
{
    ifstream.open();

    //obtain index - codes for obtaining index is correct
    {
        char *data;
        data = new char[size];
        //read from file
        data[size] = '\0';
        ifstream.seekg(index*size);
        ifstream.read(data,size);

        //encrypt data
        StreamTransformationFilter ab( encryptor,  new
CryptoPP::StringSink( CipherText ) );
        ab.Put( (const byte*)data, data_size );
        ab.MessageEnd();

        //print data
        printf(data);
    }
    ifstream.close();
}
//parallelize end

>From theory, CTR mode can be use for parallel encryption because they
can be divided in blocks and operate independently. However from my
test it doesn't seem so. Maybe I lack some codes.

Is there a way to tell the library that a block of data is only #
much?
Or what is the default CTR block size to use?
Or can anyone suggest another mode to use and how to use it (the
ciphertext must be of the same size as plain text)?

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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to