生成AES(AES-256)查找表 [英] Generating AES (AES-256) Lookup Tables
问题描述
我试图使用nVidia CUDA在CTR模式下实现AES-256。我已经成功地编码CPU代码进行密钥扩展,现在我需要实现实际的AES-256算法。根据维基百科,我看到的一些代码,特别是此PDF 第9页),AES轮次可以实现为一系列表查找。我的问题是如何生成这些表?我知道,我需要4 KB来存储这些表,这不是一个问题。我花了一整天试图找到这些表没有成功。 PDF我发布了一个链接,提及查询表T0,T1,T2和T3,但我不知道这些是什么。它也提到了圆形键4,5,6和7,但我也不明白这些索引是指什么。
I am trying to implement AES-256 in CTR mode using nVidia CUDA. I have successfully coded CPU code for key expansion and now I need to implement the actual AES-256 algorithm. According to Wikipedia, some codes I've seen and particularly this PDF (page 9), AES rounds can be implemented as series of table lookups. My question is how do I generate these tables? I am aware that I need 4 KB to store these tables, and that is not a problem. I have spent whole day trying to find these tables with no success. The PDF I posted a link to mentions lookup tables T0, T1, T2 and T3, but I do not know what these are. It also mentions round keys 4, 5, 6 and 7, but I also do not understand what these indices are referring to.
最近我来找出如何以生成这些查找表来自此项目。在代码中,有一个注释说:
The closest I have come to figuring out how to generate these lookup tables is from this project. Inside the code, there is a comment that says:
Te0[x] = S [x].[02, 01, 01, 03];
Te1[x] = S [x].[03, 02, 01, 01];
Te2[x] = S [x].[01, 03, 02, 01];
Te3[x] = S [x].[01, 01, 03, 02];
然而,我不完全确定我知道这个符号是什么意思还有别的?)。我唯一认识的是混合列部分常数矩阵,以及S盒矩阵。
However, I'm not entirely sure I know what that notation means (is it a matrix multiplication or something else?). The only thing I recognize is the mix-column part constant matrix, as well as the S-box matrix.
现在有人指出了 - 怎么可以查找实现实际上更慢?在这里不使用查找表来实现AES是明智的?
Now that someone pointed it out - how can a lookup implementation be actually slower? Would it be wise to implement AES without lookup tables here?
推荐答案
T表是AES循环变换的直接描述矩阵形式。要构建它们,请参阅原始 Rijndael NIST提案,第5.2节.1。
The T tables are a straightforward description of the AES round transformation in matrix form. To build them, see the original Rijndael NIST proposal, section 5.2.1.
这篇关于生成AES(AES-256)查找表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!