TDEA和CBC模式?

发布于 2024-09-29 14:00:00 字数 362 浏览 3 评论 0原文

我正在尝试掌握加密图和 TDEA(三重 DES)的窍门。我知道 TDEA 看起来像这样:

ciphertext = EK3(DK2(EK1(plaintext)))

我也知道链块密码使用 IV 来播种加密和加密之前的纯文本,然后输出是一个块加密后,新的 IV 由第一个块的密文的输出形成。正确的?

这意味着 CBC 模式下的 TDEA 的流程如下:

纯文本 -->四——> TDEA加密-->新四 -->密文

下一个块是:

纯文本 -->新四 --> TDEA加密-->新新四 -->密文

这会持续 n 个块。这是正确的还是我不明白它是如何工作的?

I am trying to get the hang of encryption diagrams and TDEA (Triple DES). I understand TDEA looks something like this:

ciphertext = EK3(DK2(EK1(plaintext)))

I also know a chain block cipher uses an IV to seed the encryption and the plain text before encrypting, and then the output is a block that is ciphered and the new IV is formed from the output of the first block's cipher text. Correct?

This means a TDEA in CBC mode would flow something like this:

Plain Text --> IV --> TDEA encryption --> NEW IV --> Cipher Text

The next block is:

Plain Text --> NEW IV --> TDEA encryption --> NEW NEW IV --> Cipher Text

This continues on for n number of blocks. Is this correct or am I not getting how it works?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2024-10-06 14:00:00

您对 CBC 如何运作的概念似乎有缺陷(或者至少我不明白您是如何说您相信事情有效的)。特别是,您显示的是 纯文本 -> IV,但 IV(以任何方式)依赖于纯文本。

您使用的密码算法基本上与 CBC 本身的工作方式正交(除此之外,它适用于块密码,而不是流密码)。在伪代码中,CBC 看起来像这样:

block_t xor_block = IV;
write(xor_block);
for (int i=0; i<message_size; i++) {
    block_t data = xor(xor_block, message[i]);
    xor_block = encrypt(data);
    write(xor_block);
}

Your conception of how CBC works seems to be flawed (or at least I don't understand how you're saying you believe things work). In particular, you're showing Plain Text -> IV, but the IV does not depend (in any way) on the plain text.

The cipher algorithm you use is basically orthogonal to how CBC itself works (beyond the fact that it's for block ciphers, not stream ciphers). In pseudo-code, CBC looks something like this:

block_t xor_block = IV;
write(xor_block);
for (int i=0; i<message_size; i++) {
    block_t data = xor(xor_block, message[i]);
    xor_block = encrypt(data);
    write(xor_block);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文