-
-
Notifications
You must be signed in to change notification settings - Fork 654
Description
Is there an existing issue for this?
- I have searched the existing issues for a bug report that matches the one I want to file, without success.
Did you read the documentation and troubleshoot guide?
- I have read the documentation and troubleshoot guide
Environment
- **OS**: Not OS related
- **Sage Version**: 10.0
Steps To Reproduce
from sage.crypto.sbox import SBox
S = SBox(0,0,0,1,0,0,1,3)
S.difference_distribution_table()
Expected Behavior
The correct distribution table.
Actual Behavior
IndexError Traceback (most recent call last)
Cell In [23], line 3
1 from sage.crypto.sbox import SBox
2 S = SBox(Integer(0),Integer(0),Integer(0),Integer(1),Integer(0),Integer(0),Integer(1),Integer(3))
----> 3 S.difference_distribution_table()
File /private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/misc/cachefunc.pyx:2300, in sage.misc.cachefunc.CachedMethodCallerNoArgs.call (build/cythonized/sage/misc/cachefunc.c:12752)()
2298 if self.cache is None:
2299 f = self.f
-> 2300 self.cache = f(self._instance)
2301 return self.cache
2302
File /private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/crypto/sbox.pyx:652, in sage.crypto.sbox.SBox.difference_distribution_table (build/cythonized/sage/crypto/sbox.c:8561)()
650 si = self._S_list[i]
651 for di in range(nrows):
--> 652 L[di*nrows + si ^ self._S_list[i ^ di]] += 1
653
654 A = matrix(ZZ, nrows, ncols, L)
IndexError: list index out of range
Additional Information
It works with a square SBox, but fails with non-square one. I presume the "range(nrows)" in line 651 should be "range(ncols)".