Thread: AES after block

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262

    AES after block

    Hello all,

    I'm looking through the AES encryption algorithm with the idea to implement it. I've been reading a lot about it and it seems relatively easy. However, I don't get what happens after each encrypted block. Are the round keys supposed to change, or not? I can't find any way it should change, but it sounds quite insecure.

    Let me explain a bit better. Take AES 128 bits. 16 bytes are provided for a key and they are then expended to 11 round keys of 176 bytes in total.
    Now let's say we want to encrypt 16 bytes. After this, should the round keys be changed? If they are kept the same, and the next block to encrypt contains the same 16 bytes, the cipher text would be exactly the same.

    So let's say we send "Hello, world!!!!". It produces some cipher text. Then we send the same message again, a couple of messages later, and it would result in the same cipher text.

    My bet is a new key would have to be used or something should be done to the round keys, but I can't find any documentation about this anywhere...

    So, what should be done after each encrypted block?


    Thanks in advance

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by EVOEx
    Now let's say we want to encrypt 16 bytes. After this, should the round keys be changed? If they are kept the same, and the next block to encrypt contains the same 16 bytes, the cipher text would be exactly the same.
    AES has a block size of 128 bits, i.e., 16 8-bit bytes. If you are talking about the next block, then it sounds like you should be involving an encryption mode. If you are encrypting the blocks in ECB mode, then indeed if the next block is identical, it would encrypt to the exact same ciphertext, given the same secret key. But if say you use CBC, then that should no longer be the case.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by laserlight View Post
    AES has a block size of 128 bits, i.e., 16 8-bit bytes. If you are talking about the next block, then it sounds like you should be involving an encryption mode. If you are encrypting the blocks in ECB mode, then indeed if the next block is identical, it would encrypt to the exact same ciphertext, given the same secret key. But if say you use CBC, then that should no longer be the case.
    Ahh, now that makes more sense! Thanks ;-).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. pointers
    By fanaonc in forum C Programming
    Replies: 3
    Last Post: 11-17-2001, 02:18 AM