matrix transform in des

DES standard
数学真是奇妙
DES中的IP算法

有这样一类矩阵变换
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
想要变换成
1 5 9 13
3 7 11 15
2 6 10 14
4 8 12 16

可以这样变换,过程为
开始
1 2 9 10
5 6 13 14
3 4 11 12
7 8 15 16

1 2 9 10
3 4 11 12
5 6 13 14
7 8 15 16


结束   



这只是一个16bit数的变换,DES中的是64bit变换,道理相同。
openssl中的实现用了位交换的快速算法。
如下:
出处
A very old trick is that of exchanging the contents of two registers without using a third
graphics/02icon117.gif

这里使用的是:
Exchanging Corresponding Fields of Registers
graphics/02icon121.gif

2004年9月27日10:49:44
DES中的SP-Box终于找到了,但还是看不懂。
http://www.ka9q.net作者居然在高通
2004年9月29日10:38:28

http://www.cnblogs.com/embed/archive/2004/09/29/47777.aspx
此书里有DES直接实现源代码,可以和上面的代码比较。

http://www.icdiy.org/article.php3?sid=18
des implement with verilog 中文


一些算法分析的笔记
P盒

des算法中的P盒置换定义了相应位应移到的位置,例如p32i[4]=21,表示21位应移到第4位。gensp中把P盒inverse了,例如pbox[21]=4.这样计算方便,就直接表示了21位应该移动到第4位。

posted on 2004-08-16 11:37  embed  阅读(801)  评论(0编辑  收藏  举报

导航