微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > AES解密算法的问题……

AES解密算法的问题……

时间:10-02 整理:3721RD 点击:
请教一下实现AES解密算法中的逆列混合变化和逆的行移位如何用Verilog代码实现呢,在网上没找到,如果哪位前辈知道如何设计,恳请赐教……

我猜你應該是在 modulus 上面有問題
今天假設 A* B  的結果是C
而你還要針對 C 去做 modulus

module 都能写错……

没啥说的啦  飘过 ……都麻木了

http://www.eetop.cn/bbs/thread-239812-1-1.html
有AES算法源码。

小编,有需求可以讨论,本人有刚写好的,比较实用,比网上疯传的那个好。哈哈
QQ:809174805

1# 1920
去中国期刊网下载相关硕士论文,所有问题都有的。

AES是个比较成熟的算法,去开源上看看估计应该是有的。

逆列混合其实就是有限域乘法问题,而且是变量与固定数乘法,分析一下有限域乘法怎么做,自然就知道invmixcol怎么实现了。
Finite Field Multiplication
An example is shown as below.
{57}•{83} = {57}•{01} ^ {57}•{02} ^ {57}•{80}
{57}•{01} = {57}
{57}•{02} = {AE} //(Shift 1 bit to left, and XOR{1b} if the MSB before shifting is 1)
{57}•{04} = {AE}•{02} = {1}{01011100}
{57}•{08} = {47}•{02} = {8E}
{57}•{10} = {8E }•{02} = {1}{00011100}
{57}•{20} ={07}•{02} = {0E}
{57}•{40} ={0E}•{02} = {1C}
{57}•{80} ={1C }•{02} = {38}
{57}•{83} = {57} ^ {AE} ^{38} = {C1}
Another way to calculate {57}•{83} which is suitable for hardware implementation.
{57}•{83}
= {57}•{01}^ {57}•{02} ^ {57}•{80}
= {01010111} ^ {10101110} ^ {0101011}{10000000}
= {0101011}{01111001}
Step1: {0101011}{01111001}
= {01011}{01111001} ^ {00011}{01100000}
= {01000}{00011001}
Step2: {01000}{00011001}
= {000}{00011001}^{000}{11011000}
= {11000001} = {C1}

逆列混合其实就是有限域乘法问题,而且是变量与固定数乘法,分析一下有限域乘法怎么做,自然就知道invmixcol怎么实现了。
Finite Field Multiplication
An example is shown as below.
{57}•{83} = {57}•{01} ^ {57}•{02} ^ {57}•{80}
{57}•{01} = {57}
{57}•{02} = {AE} //(Shift 1 bit to left, and XOR{1b} if the MSB before shifting is 1)
{57}•{04} = {AE}•{02} = {1}{01011100}
{57}•{08} = {47}•{02} = {8E}
{57}•{10} = {8E }•{02} = {1}{00011100}
{57}•{20} ={07}•{02} = {0E}
{57}•{40} ={0E}•{02} = {1C}
{57}•{80} ={1C }•{02} = {38}
{57}•{83} = {57} ^ {AE} ^{38} = {C1}
Another way to calculate {57}•{83} which is suitable for hardware implementation.
{57}•{83}
= {57}•{01}^ {57}•{02} ^ {57}•{80}
= {01010111} ^ {10101110} ^ {0101011}{10000000}
= {0101011}{01111001}
Step1: {0101011}{01111001}
= {01011}{01111001} ^ {00011}{01100000}
= {01000}{00011001}
Step2: {01000}{00011001}
= {000}{00011001}^{000}{11011000}
= {11000001} = {C1}

逆列混合其实就是有限域乘法问题,而且是变量与固定数乘法,分析一下有限域乘法怎么做,自然就知道invmixcol怎么实现了。
Finite Field Multiplication
An example is shown as below.
{57}•{83} = {57}•{01} ^ {57}•{02} ^ {57}•{80}
{57}•{01} = {57}
{57}•{02} = {AE} //(Shift 1 bit to left, and XOR{1b} if the MSB before shifting is 1)
{57}•{04} = {AE}•{02} = {1}{01011100}
{57}•{08} = {47}•{02} = {8E}
{57}•{10} = {8E }•{02} = {1}{00011100}
{57}•{20} ={07}•{02} = {0E}
{57}•{40} ={0E}•{02} = {1C}
{57}•{80} ={1C }•{02} = {38}
{57}•{83} = {57} ^ {AE} ^{38} = {C1}
Another way to calculate {57}•{83} which is suitable for hardware implementation.
{57}•{83}
= {57}•{01}^ {57}•{02} ^ {57}•{80}
= {01010111} ^ {10101110} ^ {0101011}{10000000}
= {0101011}{01111001}
Step1: {0101011}{01111001}
= {01011}{01111001} ^ {00011}{01100000}
= {01000}{00011001}
Step2: {01000}{00011001}
= {000}{00011001}^{000}{11011000}
= {11000001} = {C1}

不好意思,还以为没发出去,一下子发了这么多。
逆行移位就更简单了,直接以为就是了
row[31:0] = {row[7:0, row[31:8]};
这就是移位

aes不都是有现成的实现库吗?如crypt++,

乘法的种类就那么几种,就是有限域乘法,先用xtime,然后xor

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top