分组密码中的 SWAPMOVE 函数是什么?

发布于 2025-01-12 13:14:22 字数 491 浏览 0 评论 0原文

我在下面看到了一个名为“SWAPMOVE”的函数。

SWAPMOVE(A,B,M,n):
    T = (B ^ (A >> n)) & M
    B = B ^ T
    A = A ^ (T << n)

而且我不知道这个功能实际上是做什么的。

它似乎计算一些分组密码的线性层,但我无法理解使用这个函数的整个步骤。

那么,这个函数实际上是做什么的呢?

这是我看到的研究论文:Alexandre Adomnicai、Zakaria Najm 和 Thomas Peyrin。修复切片:一种新的 GIFT 表示:ARM Cortex-M 上 GIFT 和 GIFT-COFB 的快速恒定时间实现。 IACR Transactions on Cryptographic Hardware and Embedded Systems, 2020(3):402–427, Jun. 2020。

参见本文第 15~16p。

I saw a function called 'SWAPMOVE' below.

SWAPMOVE(A,B,M,n):
    T = (B ^ (A >> n)) & M
    B = B ^ T
    A = A ^ (T << n)

And I don't know what does this function actually do.

It seems to calculate the linear layer of some block ciphers, but I can't understand the entire steps using this function.

So, what does this function actually do?

This is the research paper I saw: Alexandre Adomnicai, Zakaria Najm, and Thomas Peyrin. Fixslicing: A New GIFT Representation: Fast Constant-Time Implementations of GIFT and GIFT-COFB on ARM Cortex-M. IACR Transactions on Cryptographic Hardware and Embedded Systems, 2020(3):402–427, Jun. 2020.

Look up 15~16p of this paper.

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

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

发布评论

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

评论(2

聊慰 2025-01-19 13:14:22

让我们更详细地看看这个。

假设我们没有 M,它是一个掩码。在这种情况下,B = B ^ T 将等同于 B = B ^ B ^ (A >>> n)。这本身就相当于 B = A >>> n。那么最后一行相当于 A = A ^ B ^ ((A >> n) << n),其中 B 是我们原来的 B <代码>(A >> n) << n 本质上是清除底部的 n 位并保留其余的。因此,最后一行将使用 Kn 的顶部 Kn(其中 K 是字中的总位数)计算 B 异或。代码>A。

因此,这里唯一的区别是我们有一个掩码 M,它调整字 T 中的位,从而影响哪些位包含在我们的结果值中。如果你多思考一下,应该可以推断出是什么影响了结果,尽管用文字描述有点困难。

该函数被认为是线性的,因为它仅包含 XOR、AND 和移位,而这些在 GF(2) 中是线性的。其他在 GF(2) 中呈线性的类似操作包括 CRC。这里无需过多讨论密码学(这不是主题),大多数密码算法都包含线性运算(通常提供廉价的扩散)和非线性运算(以防止使用线性密码分析来轻松解决它们)。如果您想了解有关此函数的加密目的的更多信息,您应该在 Cryptography Stack Exchange 上询问,在那里您会得到比我更有能力的密码学专家的更好的、切题的答复。

Let's look at this in some more detail.

Pretend we didn't have M, which is a mask. In such a case, B = B ^ T would be equivalent to B = B ^ B ^ (A >> n). That would itself be equivalent to B = A >> n. Then the last line would be equivalent to A = A ^ B ^ ((A >> n) << n), where B is our original B. (A >> n) << n essentially clears the bottom n bits and preserves the rest. So this last line would compute B xor'd with the top K-n (where K is the total number of bits in the word) of A.

So the only difference here is that we have a mask M, which adjusts the bits in the word T and therefore affects which bits are included in our resulting values. It should be possible to deduce what affects the results if you think about it a little more, although it's a little more difficult to describe using words.

This function is considered linear because it includes only XORs, ANDs, and shifts, and those are linear in GF(2). Other, similar operations which are linear in GF(2) include CRCs. Without going into the cryptography too much here, which isn't on topic, most cryptographic algorithms include linear operations (which often offer cheap diffusion) with non-linear operations (to prevent using linear cryptanalysis to easily solve them). If you want to know more about the cryptographic purposes of this function, you should ask that on Cryptography Stack Exchange, where you'll get a better, on-topic response by someone much more capable in cryptography than I am.

看轻我的陪伴 2025-01-19 13:14:22

正如论文第6页所述,SWAPMOVE技术

包括交换 B 中由 M 掩码的位与 A 中由 (M << n) 掩码的位

因此目标只是根据掩码 M 和移位在两个输入变量(A 和 B)之间交换一些位索引 n.

As stated in the page 6 of the paper, the SWAPMOVE technique

consists in swapping the bits in B masked by M with the bits in A masked by (M << n)

So the goal is just to swap some bits between two input variables (A and B) according to a mask M and shift index n.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文