Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
gh-36556: some fixes for pycodestyle E221
    
this is fixing some of the warnings

`E221 multiple spaces before operator`

mostly scripted with autopep8, plus a few manual cases

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
    
URL: #36556
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe, Sebastian Oehms
  • Loading branch information
Release Manager committed Nov 5, 2023
2 parents 4b52f10 + 0a81064 commit 1a4599f
Show file tree
Hide file tree
Showing 19 changed files with 213 additions and 215 deletions.
18 changes: 9 additions & 9 deletions src/sage/crypto/lwe.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ def __init__(self, n, q, D, secret_dist='uniform', m=None):
...
IndexError: Number of available samples exhausted.
"""
self.n = ZZ(n)
self.n = ZZ(n)
self.m = m
self.__i = 0
self.K = IntegerModRing(q)
self.K = IntegerModRing(q)
self.FM = FreeModule(self.K, n)
self.D = D

Expand Down Expand Up @@ -443,7 +443,7 @@ def __init__(self, n, delta=0.01, m=None):
s = sqrt(s_t_bound*floor(q/4))
# Transform s into stddev
stddev = s/sqrt(2*pi.n())
D = DiscreteGaussianDistributionIntegerSampler(stddev)
D = DiscreteGaussianDistributionIntegerSampler(stddev)
LWE.__init__(self, n=n, q=q, D=D, secret_dist='noise', m=m)


Expand Down Expand Up @@ -484,11 +484,11 @@ def __init__(self, n, instance='key', m=None):
raise TypeError("Parameter too small")

n2 = n
C = 4/sqrt(2*pi)
C = 4/sqrt(2*pi)
kk = floor((n2-2*log(n2, 2)**2)/5)
n1 = (3*n2-5*kk) // 2
ke = floor((n1-2*log(n1, 2)**2)/5)
l = (3*n1-5*ke) // 2 - n2
l = (3*n1-5*ke) // 2 - n2
sk = ceil((C*(n1+n2))**(ZZ(3)/2))
se = ceil((C*(n1+n2+l))**(ZZ(3)/2))
q = next_prime(max(ceil((4*sk)**(ZZ(n1+n2)/n1)),
Expand All @@ -499,12 +499,12 @@ def __init__(self, n, instance='key', m=None):
raise TypeError("Parameter too small")

if instance == 'key':
D = UniformSampler(0, sk-1)
D = UniformSampler(0, sk-1)
if m is None:
m = n1
LWE.__init__(self, n=n2, q=q, D=D, secret_dist='noise', m=m)
elif instance == 'encrypt':
D = UniformSampler(0, se-1)
D = UniformSampler(0, se-1)
if m is None:
m = n2+l
LWE.__init__(self, n=n1, q=q, D=D, secret_dist='noise', m=m)
Expand Down Expand Up @@ -544,11 +544,11 @@ def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None):
sage: RingLWE(N=20, q=next_prime(800), D=D) # needs sage.libs.pari
RingLWE(20, 809, Discrete Gaussian sampler for polynomials of degree < 8 with σ=3.000000 in each component, x^8 - x^6 + x^4 - x^2 + 1, 'uniform', None)
"""
self.N = ZZ(N)
self.N = ZZ(N)
self.n = euler_phi(N)
self.m = m
self.__i = 0
self.K = IntegerModRing(q)
self.K = IntegerModRing(q)

if self.n != D.n:
raise ValueError("Noise distribution has dimensions %d != %d" % (D.n, self.n))
Expand Down
6 changes: 3 additions & 3 deletions src/sage/crypto/mq/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ def key_schedule_polynomials(self, i):
si = Matrix(R, r*e, 1, self.vars("s", i-1, r, e))

rc = Matrix(R, r*e, 1, self.phi([a**(i-1)] + [k(0)]*(r-1)) )
d = Matrix(R, r*e, 1, self.phi([self.sbox_constant()]*r) )
d = Matrix(R, r*e, 1, self.phi([self.sbox_constant()]*r) )

sbox = []

Expand Down Expand Up @@ -3123,8 +3123,8 @@ def _inversion_polynomials_single_sbox(self, x=None, w=None, biaffine_only=None,
l.append( (Cw * x + o).list()[:-1] )
else:
l.append( (Cw * x + o).list() )
l.append( (Cw * S * x + x).list() )
l.append( (Cx * S * w + w).list() )
l.append( (Cw * S * x + x).list() )
l.append( (Cx * S * w + w).list() )
if not biaffine_only:
l.append( ((Cw * S**2 + Cx*S)*x).list() )
l.append( ((Cx * S**2 + Cw*S)*w).list() )
Expand Down
150 changes: 75 additions & 75 deletions src/sage/crypto/sboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ def carlet_tang_tang_liao(n, c=None, bf=None):

if n < 6 or n % 2:
raise TypeError("n >= 6 has to be even")
K = GF(2**(n-1))
L = GF(2**n)
K = GF((2, n - 1))
L = GF((2, n))

if c is None:
c = K.random_element()
Expand Down Expand Up @@ -392,7 +392,7 @@ def monomial_function(n, e):
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.finite_rings.finite_field_constructor import GF

base_ring = GF(2**n, name='x')
base_ring = GF((2, n), name='x')
R = PolynomialRing(base_ring, name='X')
X = R.gen()
return SBox(X**e)
Expand Down Expand Up @@ -516,18 +516,18 @@ def monomial_function(n, e):
112,130, 44,236,179, 39,192,229,228,133, 87, 53,234, 12,174, 65,
35,239,107,147, 69, 25,165, 33,237, 14, 79, 78, 29,101,146,189,
134,184,175,143,124,235, 31,206, 62, 48,220, 95, 94,197, 11, 26,
166,225, 57,202,213, 71, 93, 61,217, 1, 90,214, 81, 86,108, 77,
166,225, 57,202,213, 71, 93, 61,217, 1, 90,214, 81, 86,108, 77,
139, 13,154,102,251,204,176, 45,116, 18, 43, 32,240,177,132,153,
223, 76,203,194, 52,126,118, 5,109,183,169, 49,209, 23, 4,215,
223, 76,203,194, 52,126,118, 5,109,183,169, 49,209, 23, 4,215,
20, 88, 58, 97,222, 27, 17, 28, 50, 15,156, 22, 83, 24,242, 34,
254, 68,207,178,195,181,122,145, 36, 8,232,168, 96,252,105, 80,
254, 68,207,178,195,181,122,145, 36, 8,232,168, 96,252,105, 80,
170,208,160,125,161,137, 98,151, 84, 91, 30,149,224,255,100,210,
16,196, 0, 72,163,247,117,219,138, 3,230,218, 9, 63,221,148,
135, 92,131, 2,205, 74,144, 51,115,103,246,243,157,127,191,226,
16,196, 0, 72,163,247,117,219,138, 3,230,218, 9, 63,221,148,
135, 92,131, 2,205, 74,144, 51,115,103,246,243,157,127,191,226,
82,155,216, 38,200, 55,198, 59,129,150,111, 75, 19,190, 99, 46,
233,121,167,140,159,110,188,142, 41,245,249,182, 47,253,180, 89,
120,152, 6,106,231, 70,113,186,212, 37,171, 66,136,162,141,250,
114, 7,185, 85,248,238,172, 10, 54, 73, 42,104, 60, 56,241,164,
120,152, 6,106,231, 70,113,186,212, 37,171, 66,136,162,141,250,
114, 7,185, 85,248,238,172, 10, 54, 73, 42,104, 60, 56,241,164,
64, 40,211,123,187,201, 67,193, 21,227,173,244,119,199,128,158])

# source: https://www.schneier.com/academic/paperfiles/paper-cmea.pdf
Expand Down Expand Up @@ -1063,20 +1063,20 @@ def monomial_function(n, e):
newDES = SBox([
32,137,239,188,102,125,221, 72,212, 68, 81, 37, 86,237,147,149,
70,229, 17,124,115,207, 33, 20,122,143, 25,215, 51,183,138,142,
146,211,110,173, 1,228,189, 14,103, 78,162, 36,253,167,116,255,
158, 45,185, 50, 98,168,250,235, 54,141,195,247,240, 63,148, 2,
146,211,110,173, 1,228,189, 14,103, 78,162, 36,253,167,116,255,
158, 45,185, 50, 98,168,250,235, 54,141,195,247,240, 63,148, 2,
224,169,214,180, 62, 22,117,108, 19,172,161,159,160, 47, 43,171,
194,175,178, 56,196,112, 23,220, 89, 21,164,130,157, 8, 85,251,
194,175,178, 56,196,112, 23,220, 89, 21,164,130,157, 8, 85,251,
216, 44, 94,179,226, 38, 90,119, 40,202, 34,206, 35, 69,231,246,
29,109, 74, 71,176, 6, 60,145, 65, 13, 77,151, 12,127, 95,199,
57,101, 5,232,150,210,129, 24,181, 10,121,187, 48,193,139,252,
29,109, 74, 71,176, 6, 60,145, 65, 13, 77,151, 12,127, 95,199,
57,101, 5,232,150,210,129, 24,181, 10,121,187, 48,193,139,252,
219, 64, 88,233, 96,128, 80, 53,191,144,218, 11,106,132,155,104,
91,136, 31, 42,243, 66,126,135, 30, 26, 87,186,182,154,242,123,
82,166,208, 39,152,190,113,205,114,105,225, 84, 73,163, 99,111,
204, 61,200,217,170, 15,198, 28,192,254,134,234,222, 7,236,248,
201, 41,177,156, 92,131, 67,249,245,184,203, 9,241, 0, 27, 46,
133,174, 75, 18, 93,209,100,120, 76,213, 16, 83, 4,107,140, 52,
58, 55, 3,244, 97,197,238,227,118, 49, 79,230,223,165,153, 59])
204, 61,200,217,170, 15,198, 28,192,254,134,234,222, 7,236,248,
201, 41,177,156, 92,131, 67,249,245,184,203, 9,241, 0, 27, 46,
133,174, 75, 18, 93,209,100,120, 76,213, 16, 83, 4,107,140, 52,
58, 55, 3,244, 97,197,238,227,118, 49, 79,230,223,165,153, 59])

Picaro = SBox([
0x08,0x0c,0x03,0x06,0x06,0x04,0x05,0x06,0x05,0x04,0x0c,0x0c,0x04,0x03,0x05,0x03,
Expand All @@ -1097,22 +1097,22 @@ def monomial_function(n, e):
0x01,0xfd,0x75,0x8a,0xea,0x1c,0x9f,0x6a,0x5f,0xac,0x2d,0xdd,0xbc,0x45,0xcf,0x35])

Safer = SBox([
1, 45, 226, 147, 190, 69, 21, 174, 120, 3, 135, 164, 184, 56, 207, 63,
8, 103, 9, 148, 235, 38, 168, 107, 189, 24, 52, 27, 187, 191, 114, 247,
64, 53, 72, 156, 81, 47, 59, 85, 227, 192, 159, 216, 211, 243, 141, 177,
255, 167, 62, 220, 134, 119, 215, 166, 17, 251, 244, 186, 146, 145, 100, 131,
241, 51, 239, 218, 44, 181, 178, 43, 136, 209, 153, 203, 140, 132, 29, 20,
129, 151, 113, 202, 95, 163, 139, 87, 60, 130, 196, 82, 92, 28, 232, 160,
4, 180, 133, 74, 246, 19, 84, 182, 223, 12, 26, 142, 222, 224, 57, 252,
32, 155, 36, 78, 169, 152, 158, 171, 242, 96, 208, 108, 234, 250, 199, 217,
0, 212, 31, 110, 67, 188, 236, 83, 137, 254, 122, 93, 73, 201, 50, 194,
249, 154, 248, 109, 22, 219, 89, 150, 68, 233, 205, 230, 70, 66, 143, 10,
193, 204, 185, 101, 176, 210, 198, 172, 30, 65, 98, 41, 46, 14, 116, 80,
2, 90, 195, 37, 123, 138, 42, 91, 240, 6, 13, 71, 111, 112, 157, 126,
16, 206, 18, 39, 213, 76, 79, 214, 121, 48, 104, 54, 117, 125, 228, 237,
128, 106, 144, 55, 162, 94, 118, 170, 197, 127, 61, 175, 165, 229, 25, 97,
253, 77, 124, 183, 11, 238, 173, 75, 34, 245, 231, 115, 35, 33, 200, 5,
225, 102, 221, 179, 88, 105, 99, 86, 15, 161, 49, 149, 23, 7, 58, 40])
1, 45, 226, 147, 190, 69, 21, 174, 120, 3, 135, 164, 184, 56, 207, 63,
8, 103, 9, 148, 235, 38, 168, 107, 189, 24, 52, 27, 187, 191, 114, 247,
64, 53, 72, 156, 81, 47, 59, 85, 227, 192, 159, 216, 211, 243, 141, 177,
255, 167, 62, 220, 134, 119, 215, 166, 17, 251, 244, 186, 146, 145, 100, 131,
241, 51, 239, 218, 44, 181, 178, 43, 136, 209, 153, 203, 140, 132, 29, 20,
129, 151, 113, 202, 95, 163, 139, 87, 60, 130, 196, 82, 92, 28, 232, 160,
4, 180, 133, 74, 246, 19, 84, 182, 223, 12, 26, 142, 222, 224, 57, 252,
32, 155, 36, 78, 169, 152, 158, 171, 242, 96, 208, 108, 234, 250, 199, 217,
0, 212, 31, 110, 67, 188, 236, 83, 137, 254, 122, 93, 73, 201, 50, 194,
249, 154, 248, 109, 22, 219, 89, 150, 68, 233, 205, 230, 70, 66, 143, 10,
193, 204, 185, 101, 176, 210, 198, 172, 30, 65, 98, 41, 46, 14, 116, 80,
2, 90, 195, 37, 123, 138, 42, 91, 240, 6, 13, 71, 111, 112, 157, 126,
16, 206, 18, 39, 213, 76, 79, 214, 121, 48, 104, 54, 117, 125, 228, 237,
128, 106, 144, 55, 162, 94, 118, 170, 197, 127, 61, 175, 165, 229, 25, 97,
253, 77, 124, 183, 11, 238, 173, 75, 34, 245, 231, 115, 35, 33, 200, 5,
225, 102, 221, 179, 88, 105, 99, 86, 15, 161, 49, 149, 23, 7, 58, 40])

Scream = SBox([
0x20,0x8D,0xB2,0xDA,0x33,0x35,0xA6,0xFF,0x7A,0x52,0x6A,0xC6,0xA4,0xA8,0x51,0x23,
Expand Down Expand Up @@ -1433,8 +1433,8 @@ def monomial_function(n, e):
20,26,7,31,19,12,10,15,22,30,13,14,4,24,9,
18,27,11,1,21,6,16,2,28,23,5,8,3,0,17,29,25])

Shamash = SBox([16, 14, 13, 2, 11, 17, 21, 30, 7, 24, 18, 28, 26, 1, 12, 6,
31, 25, 0, 23, 20, 22, 8, 27, 4, 3, 19, 5, 9, 10, 29, 15])
Shamash = SBox([16, 14, 13, 2, 11, 17, 21, 30, 7, 24, 18, 28, 26, 1, 12, 6,
31, 25, 0, 23, 20, 22, 8, 27, 4, 3, 19, 5, 9, 10, 29, 15])

SYCON = SBox([8, 19, 30, 7, 6, 25, 16, 13, 22, 15, 3, 24, 17, 12, 4, 27, 11, 0,
29, 20, 1, 14, 23, 26, 28, 21, 9, 2, 31, 18, 10, 5])
Expand All @@ -1444,8 +1444,8 @@ def monomial_function(n, e):

Elephant = SBox([0xE, 0xD, 0xB, 0x0, 0x2, 0x1, 0x4, 0xF, 0x7, 0xA, 0x8, 0x5,
0x9, 0xC, 0x3, 0x6])
KNOT = SBox([0x4, 0x0, 0xA, 0x7, 0xB, 0xE, 0x1, 0xD, 0x9, 0xF, 0x6, 0x8,
0x5, 0x2, 0xC, 0x3])
KNOT = SBox([0x4, 0x0, 0xA, 0x7, 0xB, 0xE, 0x1, 0xD, 0x9, 0xF, 0x6, 0x8,
0x5, 0x2, 0xC, 0x3])
Pyjamask_4 = SBox([0x2, 0xd, 0x3, 0x9, 0x7, 0xb, 0xa, 0x6, 0xe, 0x0, 0xf, 0x4,
0x8, 0x5, 0x1, 0xc])
SATURNIN_0 = SBox([0x0, 0x6, 0xE, 0x1, 0xF, 0x4, 0x7, 0xD, 0x9, 0x8, 0xC, 0x5,
Expand All @@ -1457,9 +1457,9 @@ def monomial_function(n, e):
Clyde = Spook
Shadow = Spook
TRIFLE = SBox([0x0, 0xC, 0x9, 0x7, 0x3, 0x5, 0xE, 0x4, 0x6, 0xB, 0xA, 0x2,
0xD, 0x1, 0x8, 0xF])
0xD, 0x1, 0x8, 0xF])
Yarara = SBox([0x4, 0x7, 0x1, 0xC, 0x2, 0x8, 0xF, 0x3, 0xD, 0xA, 0xe, 0x9, 0xB,
0x6, 0x5, 0x0])
0x6, 0x5, 0x0])
Coral = Yarara

# DES
Expand Down Expand Up @@ -1570,44 +1570,44 @@ def monomial_function(n, e):
SERPENT_S7 = SBox([1,13,15,0,14,8,2,11,7,4,12,10,9,3,5,6])

# Other Block ciphers
KLEIN = SBox([0x7,0x4,0xA,0x9,0x1,0xF,0xB,0x0,0xC,0x3,0x2,0x6,0x8,0xE,0xD,0x5])
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])
KLEIN = SBox([0x7,0x4,0xA,0x9,0x1,0xF,0xB,0x0,0xC,0x3,0x2,0x6,0x8,0xE,0xD,0x5])
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
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])
Piccolo = SBox([0xe,0x4,0xb,0x2,0x3,0x8,0x0,0x9,0x1,0xa,0x7,0xf,0x6,0xc,0x5,0xd])
Panda = SBox([0x0,0x1,0x3,0x2,0xf,0xc,0x9,0xb,0xa,0x6,0x8,0x7,0x5,0xe,0xd,0x4])
PRESENT = SBox([0xC,0x5,0x6,0xB,0x9,0x0,0xA,0xD,0x3,0xE,0xF,0x8,0x4,0x7,0x1,0x2])
CiliPadi = PRESENT
PHOTON = PRESENT
ORANGE = PHOTON
GIFT = SBox([0x1,0xa,0x4,0xc,0x6,0xf,0x3,0x9,0x2,0xd,0xb,0x7,0x5,0x0,0x8,0xe])
HYENA = GIFT
Fountain_1 = GIFT
TGIF = GIFT
Fountain_2 = SBox([0x9, 0x5, 0x6, 0xD, 0x8, 0xA, 0x7, 0x2, 0xE, 0x4, 0xC,
0x1, 0xF, 0x0, 0xB, 0x3])
Fountain_3 = SBox([0x9, 0xD, 0xE, 0x5, 0x8, 0xA, 0xF, 0x2, 0x6, 0xC, 0x4,
0x1, 0x7, 0x0, 0xB, 0x3])
Fountain_4 = SBox([0xB, 0xF, 0xE, 0x8, 0x7, 0xA, 0x2, 0xD, 0x9, 0x3, 0x4,
0xC, 0x5, 0x0, 0x6, 0x1])
Pride = SBox([0x0,0x4,0x8,0xf,0x1,0x5,0xe,0x9,0x2,0x7,0xa,0xc,0xb,0xd,0x6,0x3])
PRINCE = SBox([0xB,0xF,0x3,0x2,0xA,0xC,0x9,0x1,0x6,0x7,0x8,0x0,0xE,0x5,0xD,0x4])
Prost = Pride
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])
Piccolo = SBox([0xe,0x4,0xb,0x2,0x3,0x8,0x0,0x9,0x1,0xa,0x7,0xf,0x6,0xc,0x5,0xd])
Panda = SBox([0x0,0x1,0x3,0x2,0xf,0xc,0x9,0xb,0xa,0x6,0x8,0x7,0x5,0xe,0xd,0x4])
PRESENT = SBox([0xC,0x5,0x6,0xB,0x9,0x0,0xA,0xD,0x3,0xE,0xF,0x8,0x4,0x7,0x1,0x2])
CiliPadi = PRESENT
PHOTON = PRESENT
ORANGE = PHOTON
GIFT = SBox([0x1,0xa,0x4,0xc,0x6,0xf,0x3,0x9,0x2,0xd,0xb,0x7,0x5,0x0,0x8,0xe])
HYENA = GIFT
Fountain_1 = GIFT
TGIF = GIFT
Fountain_2 = SBox([0x9, 0x5, 0x6, 0xD, 0x8, 0xA, 0x7, 0x2, 0xE, 0x4, 0xC,
0x1, 0xF, 0x0, 0xB, 0x3])
Fountain_3 = SBox([0x9, 0xD, 0xE, 0x5, 0x8, 0xA, 0xF, 0x2, 0x6, 0xC, 0x4,
0x1, 0x7, 0x0, 0xB, 0x3])
Fountain_4 = SBox([0xB, 0xF, 0xE, 0x8, 0x7, 0xA, 0x2, 0xD, 0x9, 0x3, 0x4,
0xC, 0x5, 0x0, 0x6, 0x1])
Pride = SBox([0x0,0x4,0x8,0xf,0x1,0x5,0xe,0x9,0x2,0x7,0xa,0xc,0xb,0xd,0x6,0x3])
PRINCE = SBox([0xB,0xF,0x3,0x2,0xA,0xC,0x9,0x1,0x6,0x7,0x8,0x0,0xE,0x5,0xD,0x4])
Prost = Pride
Qarma_sigma0 = SBox([0, 14, 2, 10, 9, 15, 8, 11, 6, 4, 3, 7, 13, 12, 1, 5])
Qarma_sigma1 = SBox([10, 13, 14, 6, 15, 7, 3, 5, 9, 8, 0, 12, 11, 1, 2, 4])
Qameleon = Qarma_sigma1
Qameleon = Qarma_sigma1
Qarma_sigma2 = SBox([11, 6, 8, 15, 12, 0, 9, 14, 3, 7, 4, 5, 13, 2, 1, 10])
REC_0 = SBox([0x9,0x4,0xF,0xA,0xE,0x1,0x0,0x6,0xC,0x7,0x3,0x8,0x2,0xB,0x5,0xD])
Rectangle = SBox([0x6,0x5,0xC,0xA,0x1,0xE,0x7,0x9,0xB,0x0,0x3,0xD,0x8,0xF,0x4,0x2])
SC2000_4 = SBox([2,5,10,12,7,15,1,11,13,6,0,9,4,8,3,14])
SKINNY_4 = SBox([0xc,0x6,0x9,0x0,0x1,0xa,0x2,0xb,0x3,0x8,0x5,0xd,0x4,0xe,0x7,0xf])
REC_0 = SBox([0x9,0x4,0xF,0xA,0xE,0x1,0x0,0x6,0xC,0x7,0x3,0x8,0x2,0xB,0x5,0xD])
Rectangle = SBox([0x6,0x5,0xC,0xA,0x1,0xE,0x7,0x9,0xB,0x0,0x3,0xD,0x8,0xF,0x4,0x2])
SC2000_4 = SBox([2,5,10,12,7,15,1,11,13,6,0,9,4,8,3,14])
SKINNY_4 = SBox([0xc,0x6,0x9,0x0,0x1,0xa,0x2,0xb,0x3,0x8,0x5,0xd,0x4,0xe,0x7,0xf])
ForkSkinny_4 = SKINNY_4
Remus_4 = SKINNY_4
Remus_4 = SKINNY_4

TWINE = SBox([0xC,0x0,0xF,0xA,0x2,0xB,0x9,0x5,0x8,0x3,0xD,0x7,0x1,0xE,0x6,0x4])
TWINE = SBox([0xC,0x0,0xF,0xA,0x2,0xB,0x9,0x5,0x8,0x3,0xD,0x7,0x1,0xE,0x6,0x4])

# Sub-components of hash functions
Luffa_v1 = SBox([0x7,0xd,0xb,0xa,0xc,0x4,0x8,0x3,0x5,0xf,0x6,0x0,0x9,0x1,0x2,0xe])
Expand Down Expand Up @@ -1654,10 +1654,10 @@ def monomial_function(n, e):
Twofish_Q1_T1 = SBox([0x1,0xE,0x2,0xB,0x4,0xC,0x3,0x7,0x6,0xD,0xA,0x5,0xF,0x9,0x0,0x8])
Twofish_Q1_T2 = SBox([0x4,0xC,0x7,0x5,0x1,0x6,0x9,0xA,0x0,0xE,0xD,0x8,0x2,0xB,0x3,0xF])
Twofish_Q1_T3 = SBox([0xB,0x9,0x5,0x1,0xC,0x3,0xD,0xE,0x6,0x4,0x7,0xF,0x2,0x0,0x8,0xA])
Kuznyechik_nu0 = SBox([0x2,0x5,0x3,0xb,0x6,0x9,0xe,0xa,0x0,0x4,0xf,0x1,0x8,0xd,0xc,0x7])
Kuznyechik_nu1 = SBox([0x7,0x6,0xc,0x9,0x0,0xf,0x8,0x1,0x4,0x5,0xb,0xe,0xd,0x2,0x3,0xa])
Kuznyechik_nu0 = SBox([0x2,0x5,0x3,0xb,0x6,0x9,0xe,0xa,0x0,0x4,0xf,0x1,0x8,0xd,0xc,0x7])
Kuznyechik_nu1 = SBox([0x7,0x6,0xc,0x9,0x0,0xf,0x8,0x1,0x4,0x5,0xb,0xe,0xd,0x2,0x3,0xa])
Kuznyechik_sigma = SBox([0xc,0xd,0x0,0x4,0x8,0xb,0xa,0xe,0x3,0x9,0x5,0x2,0xf,0x1,0x6,0x7])
Kuznyechik_phi = SBox([0xb,0x2,0xb,0x8,0xc,0x4,0x1,0xc,0x6,0x3,0x5,0x8,0xe,0x3,0x6,0xb])
Kuznyechik_phi = SBox([0xb,0x2,0xb,0x8,0xc,0x4,0x1,0xc,0x6,0x3,0x5,0x8,0xe,0x3,0x6,0xb])
Optimal_S0 = SBox([0, 1, 2, 13, 4, 7, 15, 6, 8, 11, 12, 9, 3, 14, 10, 5])
Optimal_S1 = SBox([0, 1, 2, 13, 4, 7, 15, 6, 8, 11, 14, 3, 5, 9, 10, 12])
Optimal_S2 = SBox([0, 1, 2, 13, 4, 7, 15, 6, 8, 11, 14, 3, 10, 12, 5, 9])
Expand Down
2 changes: 1 addition & 1 deletion src/sage/databases/cremona.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def _init_allbsd(self, ftpdata, largest_conductor=0):
curve_data = []
class_data = []
for L in open(ftpdata + "/" + F).readlines():
N, iso, num, eqn, rank, tor, cp, om, L, reg, sha = L.split()
N, iso, num, eqn, rank, tor, cp, om, L, reg, sha = L.split()
if largest_conductor and int(N) > largest_conductor:
break
cls = N+iso
Expand Down
Loading

0 comments on commit 1a4599f

Please sign in to comment.