Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug component_function in S-box Module and Add the S-box of WARP Block Cipher #35913

Merged
merged 24 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cdc086e
add the warp's sbox
Jul 4, 2023
3fb33c3
debugged 'component_function' in the sbox module
hadipourh Jul 4, 2023
161729c
Merge branch 'develop' into develop
hadipourh Jul 15, 2023
fa98021
Merge branch 'develop' into develop
hadipourh Oct 26, 2023
134c2ea
Merge branch 'sagemath:develop' into develop
hadipourh Dec 18, 2023
499fad8
Merge branch 'develop' into develop
hadipourh Dec 21, 2023
42b17a8
Merge branch 'develop' into develop
hadipourh Dec 31, 2023
dd31330
Merge branch 'develop' into develop
hadipourh Jan 21, 2024
227e0cb
Merge branch 'develop' into develop
hadipourh Feb 3, 2024
2331a2c
Merge branch 'develop' into develop
hadipourh Feb 15, 2024
0b20795
Merge branch 'sagemath:develop' into develop
hadipourh Apr 6, 2024
58f586b
add a test for component_function
hadipourh Apr 6, 2024
82469da
add a test for component_function
hadipourh Apr 6, 2024
68210f4
add a test for component_function
hadipourh Apr 6, 2024
302274d
add a test for component_function
hadipourh Apr 6, 2024
6749a59
Merge branch 'develop' into develop
hadipourh Apr 9, 2024
fe2d123
Merge branch 'develop' into develop
hadipourh Apr 14, 2024
46dadaf
Merge branch 'develop' into develop
hadipourh May 18, 2024
67e3a44
Merge branch 'sagemath:develop' into develop
hadipourh May 28, 2024
c545fb3
debug component_function in sbox module
hadipourh May 28, 2024
17b5d73
Merge branch 'sagemath:develop' into develop
hadipourh Jun 6, 2024
f9af42d
Merge branch 'develop' into develop
hadipourh Jun 16, 2024
cdfaf8f
Debug component_function in S-box Module and Add the S-box of WARP Bl…
hadipourh Jun 17, 2024
f43f1f9
Merge branch 'develop' into develop
hadipourh Jun 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/sage/crypto/sbox.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,13 @@
sage: f5 = S.component_function([1, 0, 1])
sage: f5.algebraic_normal_form() # needs sage.rings.polynomial.pbori
x0*x2 + x0 + x1*x2

TESTS::

sage: from sage.crypto.sboxes import SBox
sage: sb = SBox([0, 1, 2, 3, 0, 1, 2, 3])
sage: sb.component_function([1, 0])

Check failure on line 1334 in src/sage/crypto/sbox.pyx

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: Boolean function with 3 variables
Boolean function with 3 variabl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this :)

"""
cdef Py_ssize_t m = self.m
cdef Py_ssize_t n = self.n
Expand All @@ -1334,7 +1341,7 @@
b = list(b)
if len(b) > n:
raise ValueError("input (%s) is too long and would be truncated" % (b,))
b = self.from_bits(b)
b = self.from_bits(b, n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this?

except TypeError:
try:
b = ZZ(b)
Expand Down
3 changes: 2 additions & 1 deletion src/sage/crypto/sboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
- SERPENT_S0, ..., SERPENT_S7 ([BAK1998]_)
- KLEIN ([GNL2011]_)
- MIBS ([ISSK2009)]
- Midori_Sb0 (MANTIS, CRAFT), Midori_Sb1 ([BBISHAR2015]_)
- Midori_Sb0 (MANTIS, CRAFT, WARP), Midori_Sb1 ([BBISHAR2015]_)
- Noekeon ([DPVAR2000]_)
- Piccolo ([SIHMAS2011]_)
- Panda ([YWHWXSW2014]_)
Expand Down Expand Up @@ -1574,6 +1574,7 @@ def monomial_function(n, e):
MIBS = SBox([4,15,3,8,13,10,12,0,11,5,7,14,2,6,1,9])
Midori_Sb0 = SBox([0xc,0xa,0xd,0x3,0xe,0xb,0xf,0x7,0x8,0x9,0x1,0x5,0x0,0x2,0x4,0x6])
MANTIS = Midori_Sb0
WARP = Midori_Sb0
CRAFT = Midori_Sb0
Midori_Sb1 = SBox([0x1,0x0,0x5,0x3,0xe,0x2,0xf,0x7,0xd,0xa,0x9,0xb,0xc,0x8,0x4,0x6])
Noekeon = SBox([0x7,0xA,0x2,0xC,0x4,0x8,0xF,0x0,0x5,0x9,0x1,0xE,0x3,0xD,0xB,0x6])
Expand Down
Loading