是否有 8 位块大小的公钥-私钥加密算法?
我检查了 TripleDES。它的块大小为 64 位。
有8位块大小的算法吗?
谢谢
编辑:我不打算使用它来实现完美的保护,而是为了以防万一的情况,即看到代码的人不应该找到明文。所以8位对我来说还可以。
I checked out TripleDES. It's block size is of 64 bits.
Is there any algorithm for 8 bits block size?
Thanks
EDIT : I intend not to use this for perfect protection, but for a just-in-case situation where one who sees the code should not find the plaintext. So 8 bit is kinda okay for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
具有 8 位块的分组密码意味着每个输入块可以加密为 256 个可能的值,这意味着攻击者有 1/256 的机会猜测输入值。事实证明,安全地使用这样的算法非常困难。尽管如此,可能定义超过 8-位块,并“完美”地做到这一点;只是不要指望它普遍有用。
还有“无块”密码,称为“流密码”,它“逐字节”(甚至“逐位”)加密数据;大多数只是伪随机生成器,它们从密钥生成任意数量的字节。生成的流只需与要使用 XOR 加密的数据组合。传统的流密码是RC4;但是更新更好的流密码已经被设计出来。
分组密码本身就是一种数学工具。为了真正加密数据,必须正确使用分组密码。关键字是链接和填充。链接是指定义分组密码中实际包含的内容以及如何处理输出。填充是以可逆的方式向数据添加一些字节,以便填充的消息长度适合所选的链接模式。传统的链接模式称为CBC。一种更新的(可以说是更好的)链接模式是 CTR(相同链接),它具有避免填充的需要(CTR 只是将块密码转换为流密码)的额外好处。
对于分组密码,您应该使用 AES 而不是 TripleDES。它更快、更安全,是目前的美国标准。
A block cipher with 8-bit blocks means that each input block can be encrypted into 256 possible values -- which means that an attacker has a 1/256 chance of guessing the input value. It turns out to be very difficult to use such an algorithm securely. Nevertheless it is possible to define a block cipher over 8-bit blocks, and to do it "perfectly"; just do not expect it to be generally useful.
There also are "block-less" ciphers, known as "stream ciphers" which encrypt data "byte by byte" (or even "bit by bit"); most are just pseudo-random generators which produce an arbitrary amount of bytes from a key. That generated stream is just to be combined with the data to encrypt with a XOR. The traditional stream cipher is RC4; but newer and better stream ciphers have been designed.
A block cipher, by itself, is a mathematical tool. In order to actually encrypt data, the block cipher must be used properly. The keywords are chaining and padding. Chaining is about defining what actually goes into the block cipher and what to do with the output. Padding is about adding some bytes to the data, in a reversible way, so that the padded message length is appropriate for the chosen chaining mode. The traditional chaining mode is called CBC. A newer (and arguably better) chaining mode is CTR (same link), which has the added bonus of avoiding the need for padding (CTR just turns a block cipher into a stream cipher).
As for block ciphers, you should use AES instead of TripleDES. It is faster, more secure, and the current American standard.
带有 8 位密钥的 RSA :)
说真的,基于块的密码是无状态的 - 块的密文仅取决于该块的明文,而不取决于先前的块(否则它将是流密码)。作用于 8 位块的块密码很容易被暴力破解,所以没有意义。
RSA with 8-bit key :)
Seriously though, the block-based cyphers are stateless - the ciphertext of a block depends only on the cleartext of the block, not on the previous blocks (otherwise it would be a stream cypher). A block cypher that acts on 8-bit blocks can be brute-forced easily, so there's no point.