工程参考:https://github.com/bricke/Qt-AES
函数定义如下:
// MixColumns function mixes the columns of the state matrix
//optimized!!
void QAESEncryption::mixColumns()
{
QByteArray::iterator it = m_state->begin();
quint8 tmp, tm, t;
for(int i = 0; i < 16; i += 4){
t = (quint8)it[i];
tmp = (quint8)it[i] ^ (quint8)it[i+1] ^ (quint8)it[i+2] ^ (quint8)it[i+3] ;
tm = xTime( (quint8)it[i] ^ (quint8)it[i+1] );
it[i] = (quint8)it[i] ^ (quint8)tm ^ (quint8)tmp;
tm = xTime( (quint8)it[i+1] ^ (quint8)it[i+2]);
it[i+1] = (quint8)it[i+1] ^ (quint8)tm ^ (quint8)tmp;
tm = xTime( (quint8)it[i+2] ^ (quint8)it[i+3]);
it[i+2] =(quint8)it[i+2] ^ (quint8)tm ^ (quint8)tmp;
tm = xTime((quint8)it[i+3] ^ (quint8)t);
it[i&#

本文探讨了AES加密中的关键步骤——mixColumns函数,详细解释了矩阵运算过程和数据排列方式。通过实例展示了如何计算出it[0]的新值,并强调了异或运算在其中的作用,帮助读者理解这一核心概念。
最低0.47元/天 解锁文章
1730

被折叠的 条评论
为什么被折叠?



