-
-
Notifications
You must be signed in to change notification settings - Fork 660
Closed
Milestone
Description
After #27573, there are two Python 3 doctest failures in present.py:
sage -t --warn-long 61.3 src/sage/crypto/block_cipher/present.py
**********************************************************************
File "src/sage/crypto/block_cipher/present.py", line 42, in sage.crypto.block_cipher.present
Failed example:
cipher.sbox = SBox(range(16))
Exception raised:
Traceback (most recent call last):
File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/PYTHON3/sage-8.9.beta8/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/PYTHON3/sage-8.9.beta8/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.crypto.block_cipher.present[9]>", line 1, in <module>
cipher.sbox = SBox(range(Integer(16)))
File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/PYTHON3/sage-8.9.beta8/local/lib/python3.7/site-packages/sage/crypto/sbox.py", line 157, in __init__
raise TypeError("No lookup table provided.")
TypeError: No lookup table provided.
**********************************************************************
File "src/sage/crypto/block_cipher/present.py", line 44, in sage.crypto.block_cipher.present
Failed example:
cipher.encrypt(plaintext=0x1234, key=0x0).hex()
Expected:
'1234'
Got:
'cccccccccccc56b9'
The problem is that in Python 3, range(...)
does not return a list as it does in Python 3, so the SBox.__init__
method doesn't handle it well.
CC: @yhxnf
Component: python3
Author: Frédéric Chapoton
Branch/Commit: 7c494ca
Reviewer: John Palmieri, Kwankyu Lee
Issue created by migration from https://trac.sagemath.org/ticket/28403