代码之家  ›  专栏  ›  技术社区  ›  Ranhiru Jude Cooray

密码文本窃取算法-哪一个是正确的?

  •  2
  • Ranhiru Jude Cooray  · 技术社区  · 14 年前

    Web中有两种算法。

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

     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 回复  |  直到 14 年前
        1
  •  4
  •   deinst    14 年前

    这两种描述似乎是等效的。维基百科文章的第一步和第二步等同于另一篇文章的第一步。维基百科有点正式。