开发者

Cipher Text Stealing Algorithms - Which one is correct?

There are two algorithms presented in the web.

In both the algorithms, the first part is the same...

 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

However for decryption, there are two methods... I really dunno which one is correct This one was taken from here

1. If the ciphertext length is not a m开发者_JAVA百科ultiple 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.

Is this the correct decryption procedure? Will this reverse what happened in the first encryption part?

I am confused as the Wikipedia Article has the same encryption procedure but the decryption is different

Can a cryptographic expert shed some light on me? Thanx a lot in advance :)


The two descriptions seem equivalent. Steps 1 and 2 of the wikipedia article are equivalent to the first step of the other article. Wikipedia is a bit more formal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜