我正在研究差分密码分析,并找到了一个度量一个sbox对它的电阻的度量标准,但是为了使用它,有必要建立一个差分分布表,就像此链接中的一个,这是des的sobox s1表,例如,如何为AES sbox构建表?
发布于 2015-10-29 20:29:41
这些表在概念上相当容易构建,但需要大量的工作才能实际执行。
注意:列显示正在进行的对的XOR,行显示之后具有指定XOR的对数。
这个伪代码生成表:
InLength; // input length of the S-Box in bits
OutLengh; // output length of the S-Box in bits
Table[In][Out]; // the table, In is the XOR of the in-going pair, Out is the resulting XOR, the table returns the number of occurences
// Initialize the table:
for(in = 0;in<2^InLength;in++)
{
for(out = 0;out<2^OutLength;out++)
{
Table[in][out] = 0;
}
}
// this makes us go through all the possible value of p1
for(p1 = 0;p1<2^InLength;p1++)
{
// this makes us go through all the possible value of p2
for(p2 = 0;p2<2^InLength;p2++)
{
XOR_IN = p1 XOR p2;
XOR_OUT = SBOX(p1) XOR SBOX(p2);
Table[XOR_IN][XOR_OUT]++;
}
} 这样做基本上是建立S盒的每个可能的输入对,计算它的异或值,通过S-Box运行,计算结果的异或值,并在这个位置上增加值。
这个表太复杂了,无法在这里显示给AES,因为它是一个256x256表。对于实际的AES S框,请参考维基百科文章。
https://crypto.stackexchange.com/questions/30173
复制相似问题