1
$\begingroup$

CTR is amenable to parallelization because you can split the message into chunks, each chunk having a range of counter values associated with it, and encrypt (or decrypt) each chunk independently. What I would like to know is if any other modes can do this?

EDIT:

My reason for wanting to know this is that I have a class with and encrypt function, and if you encrypted two plaintexts with CBC mode for example, it encrypts them from scratch. If I'm using a mode in which that doesn't matter, CTR for example, then I won't raise an error if the user tries to encrypt another block.

$\endgroup$
  • $\begingroup$ Did you do your research Block_cipher_mode_of_operation, ECB, OCB,... Why do you need the list? What is your aim? $\endgroup$ – kelalaka Oct 14 at 8:52
  • $\begingroup$ The way the encrypt method works is it calls another encrypt method deeper in code that always starts from scratch $\endgroup$ – Legorooj Oct 14 at 9:37
  • $\begingroup$ I know that. I also know slot about how home grown crypto is bad etc so you don't need to tell me. The user is just encrypting data - it's a python library - I have no idea what the user will use it for. It wraps around code which is used be Talos for their transaction servers, which handle billions of dollars daily $\endgroup$ – Legorooj Oct 14 at 10:31
  • $\begingroup$ @kelalaka all I want is a list of modes that can be decrypted like ctr $\endgroup$ – Legorooj Oct 14 at 10:31
  • $\begingroup$ I also happen to be a bit paranoid (to the extent I use AES-CTR-HMAC like 3DES) so I know my applied crypto $\endgroup$ – Legorooj Oct 14 at 10:34
3
$\begingroup$

The practical answer is that you should almost certainly be using authenticated encryption, in which case authenticating an individual encrypted message requires you to process all of it anyway. Once you throw in this element, random access into encrypted data becomes not a matter of message encryption modes, but rather of how to split your data into a collection of messages that you can encrypt and authenticate individually.

The literal answer is that among the classic confidentiality-only block cipher modes, CBC and CTR can start decrypting from any block, while CFB and OFB cannot. You can read this pretty straightforwardly from mode diagrams; here's CBC decryption (diagrams from Wikipedia entry):

CBC mode decryption (from Wikipedia)

Neither of the inputs to each block cipher call require the output of any other other block cipher call—there are no arrows going outside of one block cipher decryption box and into another, unlike for example with OFB mode:

OFB mode decryption (from Wikipedia)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.