DES加密秘钥

1 秘钥长度

Each algorithm is designed to accept a certain key length. The key is used as part of the algorithm, and as such, can’t be whatever your heart desires.

Common key sizes are:

DES: 56bit key
AES: 128-256bit key (commonly used values are 128, 192 and 256)
RSA (assymetric cryptography): 1024, 2048, 4096 bit key

The key must have size 64-bits but only 56-bits are used from the key. The other 8-bits are parity bits (internal use).

2 校验位

DES算法的加密密钥是根据用户输入的密码生成的,该算法把64位密码中的第8位、第16位、第24位、第32位、第40位、第48位、第56位、第64位作为奇偶校验位,在计算密钥时要忽略这8位.如果输入的密码只是在这8位上有区别的话,那么操作后的结果将是一样的.
例:
输入的密码为wuzhenll,密钥的16进制表示为77 75 7A 68 65 6E 6C 6C
任意改变这64位数据的奇偶校验位,可以得到16个不同的密码,
把8个奇偶检验位全取反后:
w->v
u->t
z->{
h->i
e->d
n->o
l->m
形成新密码:vt{idomm
表面上新密码和原密码迥然不同,但是由于他们仅在奇偶校验位上有区别,所以用这两个密码进行加密解密操作得到的结果是一样的.

参考

1、How should I create my DES key? Why is an 7-character string not enough?
2、DES算法中密钥的校验位

猜你喜欢

转载自blog.csdn.net/t_1007/article/details/80633987