关于DES加密内部版讲解

Posted lovesoul

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于DES加密内部版讲解相关的知识,希望对你有一定的参考价值。

数据加密算法(Data Encryption Algorithm,DEA)是一种对称加密算法,很可能是使用最广泛的密钥系统,特别是在保护金融数据的安全中,最初开发的DEA是嵌入硬件中的。通常,自动取款机(Automated Teller Machine,ATM)都使用DEA。它出自IBM的研究工作,IBM也曾对它拥有几年的专利权,但是在1983年已到期后,处于公有范围中,允许在特定条件下可以免除专利使用费而使用。1977年被美国政府正式采纳。 DES的原始思想可以参照二战德国的恩格玛机,其基本思想大致相同。传统的密码加密都是由古代的循环移位思想而来,恩格玛机在这个基础之上进行了扩散模糊。但是本质原理都是一样的。现代DES在二进制级别做着同样的事:替代模糊,增加分析的难度。 DES的加密原理,是使用一个 56 位的密钥以及附加的 8 位奇偶校验位,产生最大 64 位的分组大小。这是一个迭代的分组密码,使用称为 Feistel 的技术,其中将加密的文本块分成两半。使用子密钥对其中一半应用循环功能,然后将输出与另一半进行“异或”运算;接着交换这两半,这一过程会继续下去,但最后一个循环不交换。DES 使用 16 个循环,使用异或,置换,代换,移位操作四种基本运算。 类似于:A1ez8zw/wJ6QNPeMblfS+ZG37vG7h31Vj64liR4RidZTp4KlFqa2DthgOMHQqLDuDXEl0oLujJJ6rDm1SDdAhEiepEqkAJnGCFYjjpw4OyYB+cWSr2sS+CGrxMcc2XMIEHSleTcD0Ff4oR0foJtRZAedXwKBnh6zGvS/PgbjN9TnJ9kAfnGoYYEdbjd7dbGAMG/dYtVljbhjAtsnhkPECzAUOLySKzPmmrdTLDGyWHWSqOGwQQaAPfEpkZi5nU4c0eSO6IVpbGP+MdiTm5TUtnNNQsmEw3ABAeoy6O53KkdGn42N24sjVcnPXM69xTOJHaPCj4zeHNoSKo6HShhRF1zHd8evfB1K8lsxGcGujGi6JNpjmkXxEJOx94+Q46JW23eFUi7uxH0QlZ/aEnzNyIj0zvzKNZdu+w3f3Rlbwu6XcXI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vVIPugHulbYLy5hNEmUFzNcXafH7ux0Vn6rv0xxlMwLCOtH7i/Ee6r99NR9eq4IH9WYV4beSShmaAfQseVkQLSAkU/0czT/dJYbgwUn5M=当然,这些都是base64编码。那么,什么是base64呢? Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一,大家可以查看RFC2045~RFC2049,上面有MIME的详细规范。Base64编码可用于在HTTP环境下传递较长的标识信息。例如,在Java Persistence系统Hibernate中,就采用了Base64来将一个较长的唯一标识符(一般为128-bit的UUID)编码为一个字符串,用作HTTP表单和HTTP GET URL中的参数。在其他应用程序中,也常常需要把二进制数据编码为适合放在URL(包括隐藏表单域)中的形式。此时,采用Base64编码不仅比较简短,同时也具有不可读性,即所编码的数据不会被人用肉眼所直接看到。 比如,编写一个“123”,得出的结果就是“MTIz”。

以上是关于关于DES加密内部版讲解的主要内容,如果未能解决你的问题,请参考以下文章

PHP版DES算法加密数据(3DES)另附openssl_encrypt版本

简易版DES加密和解密详解

使用C# DES解密java DES加密的字符串

DES加密算法安全吗,有哪些优点和缺点?

关于php des 加密 密钥长度问题

plsql实现DES对称加密