Cryptography Tutorials - Herong's Tutorial Examples - v5.41, by Herong Yang
AES Key Schedule Example
An example of the AES key schedule is provided to illustrate how 11 round keys get calculate from a given 128-bit cipher key.
As an example, let's try to follow the algorithm of the KeyExpansion() procedure, and expand a real cipher key to 11 round keys. This example was presented in the FIPS publication, "Announcing the ADVANCED ENCRYPTION STANDARD (AES)" at http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf in 2001.
Here is the given cipher key in hexadecimal format: K = 0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x09cf4f3c Performing w[0..3] = K: w[0] = 0x2b7e1516 w[1] = 0x28aed2a6 w[2] = 0xabf71588 w[3] = 0x09cf4f3c temp = w[3]: 0x09cf4f3c for i = 4: RotWord(temp): 0xcf4f3c09 SubWord(temp): 0x8a84eb01 temp XOR 0x01000000: 0x8b84eb01 temp XOR w[0]: 0xa0fafe17 w[4] = 0xa0fafe17 for i = 5: temp XOR w[1]: 0x88542cb1 w[5] = 0x88542cb1 for i = 6: temp XOR w[2]: 0x23a33939 w[6] = 0x23a33939 for i = 7: temp XOR w[3]: 0x2a6c7605 w[7] = 0x2a6c7605 for i = 8: RotWord(temp): 0x6c76052a SubWord(temp): 0x50386be5 temp XOR 0x02000000: 0x52386be5 temp XOR w[4]: 0xf2c295f2 w[8] = 0xf2c295f2 for i = 9: temp XOR w[5]: 0x7a96b943 w[9] = 0x7a96b943 for i = 10: temp XOR w[6]: 0x5935807a w[10] = 0x5935807a for i = 11: temp XOR w[7]: 0x7359f67f w[11] = 0x7359f67f for i = 12: RotWord(temp): 0x59f67f73 SubWord(temp): 0xcb42d28f temp XOR 0x04000000: 0xcf42d28f temp XOR w[8]: 0x3d80477d w[12] = 0x3d80477d for i = 13: temp XOR w[9]: 0x4716fe3e w[13] = 0x4716fe3e for i = 14: temp XOR w[10]: 0x1e237e44 w[14] = 0x1e237e44 for i = 15: temp XOR w[11]: 0x6d7a883b w[15] = 0x6d7a883b
for i = 16: RotWord(temp): 0x7a883b6d SubWord(temp): 0xdac4e23c temp XOR 0x08000000: 0xd2c4e23c temp XOR w[12]: 0xef44a541 w[16] = 0xef44a541 for i = 17: temp XOR w[13]: 0xa8525b7f w[17] = 0xa8525b7f for i = 18: temp XOR w[14]: 0xb671253b w[18] = 0xb671253b for i = 19: temp XOR w[15]: 0xdb0bad00 w[19] = 0xdb0bad00 for i = 20: RotWord(temp): 0x0bad00db SubWord(temp): 0x2b9563b9 temp XOR 0x10000000: 0x3b9563b9 temp XOR w[16]: 0xd4d1c6f8 w[20] = 0xd4d1c6f8 for i = 21: temp XOR w[17]: 0x7c839d87 w[21] = 0x7c839d87 for i = 22: temp XOR w[18]: 0xcaf2b8bc w[22] = 0xcaf2b8bc for i = 23: temp XOR w[19]: 0x11f915bc w[23] = 0x11f915bc for i = 24: RotWord(temp): 0xf915bc11 SubWord(temp): 0x99596582 temp XOR 0x20000000: 0xb9596582 temp XOR w[20]: 0x6d88a37a w[24] = 0x6d88a37a for i = 25: temp XOR w[21]: 0x110b3efd w[25] = 0x110b3efd for i = 26: temp XOR w[22]: 0xdbf98641 w[26] = 0xdbf98641 for i = 27: temp XOR w[23]: 0xca0093fd w[27] = 0xca0093fd for i = 28: RotWord(temp): 0x0093fdca SubWord(temp): 0x63dc5474 temp XOR 0x40000000: 0x23dc5474 temp XOR w[24]: 0x4e54f70e w[28] = 0x4e54f70e for i = 29: temp XOR w[25]: 0x5f5fc9f3 w[25] = 0x5f5fc9f3 for i = 30: temp XOR w[26]: 0x84a64fb2 w[26] = 0x84a64fb2
for i = 31: temp XOR w[27]: 0x4ea6dc4f w[31] = 0x4ea6dc4f for i = 32: RotWord(temp): 0xa6dc4f4e SubWord(temp): 0x2486842f temp XOR 0x80000000: 0xa486842f temp XOR w[28]: 0xead27321 w[32] = 0xv for i = 33: temp XOR w[29]: 0xb58dbad2 w[33] = 0xb58dbad2 for i = 34: temp XOR w[30]: 0x312bf560 w[34] = 0x312bf560 for i = 35: temp XOR w[31]: 0x7f8d292f w[35] = 0x7f8d292f for i = 36: RotWord(temp): 0x8d292f7f SubWord(temp): 0x5da515d2 temp XOR 0x1b000000: 0x46a515d2 temp XOR w[32]: 0xac7766f3 w[36] = 0xac7766f3 for i = 37: temp XOR w[33]: 0x19fadc21 w[33] = 0x19fadc21 for i = 38: temp XOR w[34]: 0x28d12941 w[38] = 0x28d12941 for i = 39: temp XOR w[35]: 0x575c006e w[39] = 0x575c006e for i = 40: RotWord(temp): 0x5c006e57 SubWord(temp): 0x4a639f5b temp XOR 0x36000000: 0x7c639f5b temp XOR w[36]: 0xd014f9a8 w[40] = 0xd014f9a8 for i = 41: temp XOR w[37]: 0xc9ee2589 w[41] = 0xc9ee2589 for i = 42: temp XOR w[38]: 0xe13f0cc8 w[42] = 0xe13f0cc8 for i = 43: temp XOR w[39]: 0xb6630ca6 w[43] = 0xb6630ca6 Building 11 round keys from w[] k[ 0] = 0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x09cf4f3c k[ 1] = 0xa0fafe17, 0x88542cb1, 0x23a33939, 0x2a6c7605 k[ 2] = 0xf2c295f2, 0x7a96b943, 0x5935807a, 0x7359f67f k[ 3] = 0x3d80477d, 0x4716fe3e, 0x1e237e44, 0x6d7a883b k[ 4] = 0xef44a541, 0xa8525b7f, 0xb671253b, 0xdb0bad00 k[ 5] = 0xd4d1c6f8, 0x7c839d87, 0xcaf2b8bc, 0x11f915bc k[ 6] = 0x6d88a37a, 0x110b3efd, 0xdbf98641, 0xca0093fd k[ 7] = 0x4e54f70e, 0x5f5fc9f3, 0x84a64fb2, 0x4ea6dc4f k[ 8] = 0xead27321, 0xb58dbad2, 0x312bf560, 0x7f8d292f k[ 9] = 0xac7766f3, 0x19fadc21, 0x28d12941, 0x575c006e k[10] = 0xd014f9a8, 0xc9ee2589, 0xe13f0cc8, 0xb6630ca6
Table of Contents
►Introduction to AES (Advanced Encryption Standard)
What Is AES (Advanced Encryption Standard)?
AES, or Rijndael, Encryption Algorithm
AES MixColumns() Procedure Algorithm
Example Vector of AES Encryption
AES Standard Decryption Algorithm
AES Equivalent Decryption Algorithm
DES Algorithm - Illustrated with Java Programs
DES Algorithm Java Implementation
DES Algorithm - Java Implementation in JDK JCE
DES Encryption Operation Modes
PHP Implementation of DES - mcrypt
Blowfish - 8-Byte Block Cipher
Secret Key Generation and Management
Cipher - Secret Key Encryption and Decryption
RSA Implementation using java.math.BigInteger Class
Introduction of DSA (Digital Signature Algorithm)
Java Default Implementation of DSA
Private key and Public Key Pair Generation
PKCS#8/X.509 Private/Public Encoding Standards
Cipher - Public Key Encryption and Decryption
OpenSSL Introduction and Installation
OpenSSL Generating and Managing RSA Keys
OpenSSL Generating and Signing CSR
OpenSSL Validating Certificate Path
"keytool" and "keystore" from JDK
"OpenSSL" Signing CSR Generated by "keytool"
Migrating Keys from "keystore" to "OpenSSL" Key Files
Certificate X.509 Standard and DER/PEM Formats
Migrating Keys from "OpenSSL" Key Files to "keystore"