> > On Thursday, 7 January 2016 11:07:34 UTC+10:30, Jeffrey Walton wrote: >> >> >> On Tuesday, January 5, 2016 at 10:24:48 PM UTC-5, Atton Mathews wrote: >>> >>> I've tried multithreading AES however it seems to crash in every once >>> the limit of the buffer... >>> >> >> Crypto++ is thread safe at the class level, meaning there is no shared >> data among class objects. When you want multiple threads to access the same >> class object, you have to provide the locks and barriers. >> > > Please elaborate on how that would be achieved, is there a reference > somewhere I should use? >
Typically you use pthread_mutex_t on Linux and Unix; and critical sections on Windows. You can use OpenMP, too. OpenMP has the benefit of being cross platform. However, all my OpenMP testing with Crypto++ shows the library runs slower, not faster. Maybe it made a difference back in 2006 when OpenMP was added to Crypto++ 5.3. Your mileage may vary. Also, since you are basically using only AES encryption in ECB mode, you might want to call AES::Encryption's ProcessBlock or AdvancedProcessBlock directly (http://www.cryptopp.com/docs/ref/class_block_transformation.html). Then, use one shared string, and dispatch a task that is composed of the index into the string. Each core can then use AES::Encryption on its substring. Prior to tasking, set up your result buffer and key the encryption object. You can also use the same buffer for input and output. The only limitation is the buffers cannot overlap. They can be the same, or they can be distinct. They just can't overlap in a block (16 bytes for AES). Jeff -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.