# what method of transposition does AES 256 encryption use

I'm interested in learning how to use AES-256 encryption in C/C++. I'm still a beginner in Cryptography but I'm confident in my abilities to program.

There is still a lot for me to learn about this topic so please don't respond telling me that I shouldn't be implementing the algorithm or that I should be in college. I'm not, and never will be.

My question is just on the method of transposition used after you send the function a message and a key. I don't fully understand how to use the key but I understand enough to know that the message chars go though a function that gets called a minimum of 10 times. I also understand that the function goes through a processes of Substitution -> Transposition -> Substitution -> XOR

My question regards Transposition. I understand two methods(I don't know their name) One where you draw your message bit by bit on a line alternating top and bottom, eventually combining the top half with the bottom half. The other method I understand is where you have say a number and use the number to encrypt ex:

3612
hell
othe
rexy


cipher text: lhxleyhorete

Which methods are used in AES-256? Does it use more than one?

What method of transposition does AES use?

Transposition is a simple movement of data to an alternative location. There are two relevant steps in AES when it comes to transposition: addRoundKey and shiftRows.

The addRoundKey step incorporates a bitwise rotate left. This is a transposition of bits within a single word.

## shiftRows

The shiftRows step is a transposition of bytes in the state. Each of the four rows of the state are shifted by an amount from $0$ to $3$ places. This step is designed to work in tandem with the mixColumns operation to ensure that changes in the state diffuse evenly and completely through the rest of the state.

## Conclusion

The addRoundKey function incorporates a bitwise transposition, and the shiftRows step of the main function is a byte-wise transposition.

## Note

I'm interested in learning how to use AES-256 encryption in C/C++

All that being said, if you want to learn how the algorithm works, then implementing it is a good strategy and you should do so. But there is a lot more than functional correctness to consider in a secure crypto library - your code can produce correct input/outputs while still being vulnerable to all kinds of subtle and impressive attacks. After you are done implementing you might see if you can find/use any of these attacks to break your program.

If you intend to use AES to protect users data in the real world, you should strongly consider using a pre-existing library such as libsodium*.

* Note: I am not discouraging you from writing your own code, but using it is a different story. You wouldn't self-study karate for 2 weeks and then start up a mercenary protection service, for reasons that are obvious in the real world but not necessarily so obvious in the information world. Empowering yourself is great, but protecting people is against powerful adversaries who mean business needs to be taken seriously

• Don't you also put blocks together when performing the MixColumns part of the algorithm? That's not just transposition, but the information in the bits is certainly distributed, right? – Maarten Bodewes Apr 29 '18 at 20:51
• @MaartenBodewes "transposition" means a re-arrangement/permutation of terms, like a shuffle; the same set of values that are input are output, just re-arranged. The outputs of the mixColumns function are not just a re-arrangement of the inputs. It does distribute bits, but I wouldn't classify it as a transposition. – Ella Rose Apr 29 '18 at 21:50
• That is a fine explanation, but if you don't mind I'll leave the comment here to remind future readers that the direct transposition using ShiftLeft / AddRoundKey is not the only way the information is distributed... – Maarten Bodewes Apr 29 '18 at 21:53