Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:35:22+00:00 2026-05-20T04:35:22+00:00

I’ve managed successfully to write my own AES implementation using a 128bit key. However

  • 0

I’ve managed successfully to write my own AES implementation using a 128bit key. However I’m still dangled how to interpret the AddRoundKey function using 192bit and 256bit keys.

Some facts:

  • Block is 128 bits (State)
  • Rounds 128bit = 10, 192bit = 12, 256bit = 14
  • Nk 128bit = 4 (equal to Block size), 192bit = 6, 256bit = 8 (units are words)

If Nk = 8 and i-4 is a multiple of Nk,
then SubWord() is applied to w[i-1]
prior to the XOR.

Does anyone know how 192bit and 256bit keys are applied? Any replies are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:35:23+00:00Added an answer on May 20, 2026 at 4:35 am

    I think you’ve got things slightly confused. From FIPS-197:

    In the AddRoundKey() transformation, a Round Key is added to the State by a simple bitwise
    XOR operation. Each Round Key consists of Nb words from the key schedule

    So the AddRoundKey() function xor’s the state with the appropriate word from the key schedule. Now again from FIPS-197:

    KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk)
    begin
    word temp
    i = 0
    while (i < Nk) # copy key to first Nk bytes of key sched. w is the key sched.
        w[i] = word(key[4*i], key[4*i+1], key[4*i+2], key[4*i+3])
        i = i+1
    end while
    i = Nk
    while (i < Nb * (Nr+1)] # for remaining key schedule size
        temp = w[i-1]       # get previous word
        if (i mod Nk = 0)   # if i is a multiple of Nk a.k.a. every key length
            temp = SubWord(RotWord(temp)) xor Rcon[i/Nk]
        else if (Nk > 6 and i mod Nk = 4) # this for 256-bit keys only
            temp = SubWord(temp)
        end if
        w[i] = w[i-Nk] xor temp  # the xor operation
        i = i + 1                # if you've used a for loop, ignore this.
    end while
    

    This is actually fairly straightforward. The first NK words of the key schedule are the key. From then on, you create each word by xor with the previous word unless this particular word is an exact multiple of Nk, in which case you apply the Subword function as described in FIPS-197 on the output of the rotated word xor’d by the round constant number for that particular round (i/Nk will be a whole number since i%Nk==0).

    Then, the bit you’re confused with: If Nk > 6, so if we’re using 256-bit keys, and i mod Nk == 4 i.e. (q*Nk)+4 is i for some q, then you do your pre-xor Subword.

    Finally, whatever happens, prior, the contents of the previous word are still xor’d with temp.

    The difference in the key schedule is with 256-bit keys.

    If it helps, the way to know you’ve done this right is to use the test vectors available in FIPS-197 or the NIST AES package. There are test vectors for key schedules at all bit levels; give them a go, they’ll tell you when you’ve got things wrong.

    1. FIPS-197
    2. Useful explanation of AES. You’ve probably got past most of this, but it’s a good guide. Shamelessly stolen from wikipedia,
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am using JSon response to parse title,date content and thumbnail images and place
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.