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

Add inversion function for sage.crypto.sboxes #39309

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions src/sage/crypto/sboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,28 @@ def monomial_function(n, e):
return SBox(X**e)


def inversion(n):
r"""
Return the S-Box constructed from the inversion mapping over `\GF{2^n}`
extending `0 \mapsto 0`.

rusydi marked this conversation as resolved.
Show resolved Hide resolved
INPUT:

- ``n`` -- size of the S-Box

EXAMPLES::

sage: from sage.crypto.sboxes import inversion
sage: S4 = inversion(4)
sage: S4.differential_uniformity()
4
sage: S5 = inversion(5)
sage: S5.differential_uniformity()
2
"""
return monomial_function(n, 2**n - 2)


# Bijective S-Boxes mapping 9 bits to 9
# =====================================

Expand Down
Loading