algorithm - 密文窃取算法 - 哪一种是正确的?

标签 algorithm cryptography encryption

网络上有两种算法。

在这两种算法中,第一部分是相同的......

 1. Pad the last partial plaintext block
    with 0.

 2. Encrypt the whole padded plaintext
    using the standard CBC mode.

 3. Swap the last two ciphertext blocks.

 4. Truncate the ciphertext to the length of the original plaintext

但是解密有两种方法...我真的不知道哪一种是正确的 这个取自here

1. If the ciphertext length is not a multiple of the block size, say it is n bits short, then pad it with the last n bits of the block cipher decryption of the last full ciphertext block.
2. Swap the last two ciphertext blocks.
3. Decrypt the ciphertext using the Cipher Block Chaining mode.
4. Truncate the plaintext to the length of the original ciphertext.

这是正确的解密过程吗?这会逆转第一个加密部分发生的情况吗?

我很困惑 Wikipedia Article具有相同的加密过程,但 decryption is different

密码学专家可以帮我解释一下吗?提前非常感谢:)

最佳答案

这两个描述看起来是相同的。维基百科文章的步骤 1 和 2 相当于另一篇文章的第一步。维基百科更正式一些。

关于algorithm - 密文窃取算法 - 哪一种是正确的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3407842/

相关文章:

从数组中删除唯一元素并按原始顺序打印元素的算法

python - 是否有一种方法/算法可以从给定数字的质因数生成唯一的整数?

sql - Azure SQL 数据库中的 EncryptByKey 和 EncryptByPass 使用哪种加密算法?

c# - 如何使用 TPM(可信平台模块)加密字节

php - 带 Padding 的 AES 256 加密 PHP

algorithm - 文本分类/分类算法

Java - 如何从集合中删除具有相同属性值的元素?

python - Python 中的 AES 128

java - 应用集群数据加密

node.js - 我如何使用 nodejs 中的 Diffie-Hellman api 实际加密某些内容?