none
What are the maximum text length that can be encrypted using popular algorithms? RRS feed

  • Question

  • How much text (string/length) can be encrypted using AES (256 bits) and so on?

    Does the key size affect the length of text?

    Hope to get some answers. Thanks.

    Monday, February 2, 2009 9:04 AM

Answers

  • Block ciphers and stream cipers only encrypt one block (or byte in the case of stream ciphers) at a time. However, there's no limit to the number of blocks that can be encrypted. You simply keep passing as many blocks as needed through the algorithm.

    The .NET implementation of AES encryption or any of the other block ciphers (DES, 3DES, etc.) automatically does this for you. So basically, you just pass as much data as you want and it will come out encrypted on the other side. The real limitation here is available memory. On a 32-bit system, you have slightly over 2Gb of available memory to cram data. If you are processing relatively large amounts of data (from files, for example), you can utilize streaming and buffering, particularly through the CryptoStream class, but the amount of data that can be processed by the cipher isn't limited to the cipher's block or key size.

    Asymmetric ciphers (which Ray is referring to) use a key pair (public/private key) to perform a single calculation using very large prime numbers and exponents. This type of encryption is limited in data size, proportional to the key size, because it sets up the size of the large number as an operand. Some people repeatedly put chunks of data through these algorithms as if they were block ciphers, but the .NET implementation doesn't natively support this, not to mention that these algorithms are typically a lot slower than true block ciphers, and so aren't ideally suited for this. Normally, asymmetric ciphers are used to encrypt small pieces of data, for example, in the creation of digital signatures or for handling key exchange protocols.

    The key size of a block cipher also doesn't affect the size of the cipher text (the encrypted text). But the block size does (note that the key and block sizes can often differ, depending on the algorithm). The cipher text is almost always a multiple of the block size. If the input data wasn't an exact multiple of the block size, then the last block will contain padding.


    -Rob Teixeira
    • Marked as answer by Zhi-Xin Ye Friday, February 6, 2009 2:57 PM
    Monday, February 2, 2009 5:42 PM

All replies

  • The amount of data encrypted is not limited to any maximum value. The key size does not affect the length of text at all; it is only used for the length of the key.

            -Steve
    Monday, February 2, 2009 2:00 PM
  • The only limit is the ammout of computing power you want to throw at it, Asynchronous encryption (Public/Private keypair systems such as RSA etc) are significatly slower then symetic ecryption (same key for encrypt/decrypt  EAS,DES,3DES etc etc) so to say there is a limit not really however making the user wait several seconds/minutes/hours/days while you decrypt his data not very userfriendly :)

    Monday, February 2, 2009 2:22 PM
  • Block ciphers and stream cipers only encrypt one block (or byte in the case of stream ciphers) at a time. However, there's no limit to the number of blocks that can be encrypted. You simply keep passing as many blocks as needed through the algorithm.

    The .NET implementation of AES encryption or any of the other block ciphers (DES, 3DES, etc.) automatically does this for you. So basically, you just pass as much data as you want and it will come out encrypted on the other side. The real limitation here is available memory. On a 32-bit system, you have slightly over 2Gb of available memory to cram data. If you are processing relatively large amounts of data (from files, for example), you can utilize streaming and buffering, particularly through the CryptoStream class, but the amount of data that can be processed by the cipher isn't limited to the cipher's block or key size.

    Asymmetric ciphers (which Ray is referring to) use a key pair (public/private key) to perform a single calculation using very large prime numbers and exponents. This type of encryption is limited in data size, proportional to the key size, because it sets up the size of the large number as an operand. Some people repeatedly put chunks of data through these algorithms as if they were block ciphers, but the .NET implementation doesn't natively support this, not to mention that these algorithms are typically a lot slower than true block ciphers, and so aren't ideally suited for this. Normally, asymmetric ciphers are used to encrypt small pieces of data, for example, in the creation of digital signatures or for handling key exchange protocols.

    The key size of a block cipher also doesn't affect the size of the cipher text (the encrypted text). But the block size does (note that the key and block sizes can often differ, depending on the algorithm). The cipher text is almost always a multiple of the block size. If the input data wasn't an exact multiple of the block size, then the last block will contain padding.


    -Rob Teixeira
    • Marked as answer by Zhi-Xin Ye Friday, February 6, 2009 2:57 PM
    Monday, February 2, 2009 5:42 PM