Skip to content

Commit

Permalink
Remove more py2 code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jörn Heissler committed May 17, 2021
1 parent 05562a8 commit 08f49e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/nacl/bindings/crypto_core_ristretto255.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division, print_function

from nacl import exceptions as exc
from nacl._sodium import ffi, lib
from nacl.exceptions import ensure
Expand Down
2 changes: 0 additions & 2 deletions src/nacl/bindings/crypto_scalarmult_ristretto255.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division, print_function

from nacl import exceptions as exc
from nacl._sodium import ffi, lib
from nacl.exceptions import ensure
Expand Down
6 changes: 2 additions & 4 deletions src/nacl/ristretto.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division, print_function

from fractions import Fraction

import nacl.bindings
from nacl import exceptions as exc
from nacl.utils import random


class Ristretto255Scalar(object):
class Ristretto255Scalar:
SIZE = nacl.bindings.crypto_core_ristretto255_SCALAR_BYTES
NONREDUCED_SIZE = (
nacl.bindings.crypto_core_ristretto255_NONREDUCED_SCALAR_BYTES
Expand Down Expand Up @@ -191,7 +189,7 @@ def __str__(self):
)


class Ristretto255Point(object):
class Ristretto255Point:
SIZE = nacl.bindings.crypto_core_ristretto255_BYTES
HASH_SIZE = nacl.bindings.crypto_core_ristretto255_HASH_BYTES
ORDER = nacl.bindings.crypto_core_ristretto255_GROUP_ORDER
Expand Down
12 changes: 5 additions & 7 deletions tests/test_ristretto.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division, print_function

import json
import os
from fractions import Fraction
Expand Down Expand Up @@ -57,7 +55,7 @@ def _ristretto255_vectors():
}


class TestRistretto255Scalar(object):
class TestRistretto255Scalar:
order = 7237005577332262213973186563042994240857116359379907606001950938285454250989
order_bytes = bytes.fromhex(
"edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010"
Expand Down Expand Up @@ -367,7 +365,7 @@ def test_str(self):
assert text == "Ristretto255Scalar(123)"


class TestRistretto255Point(object):
class TestRistretto255Point:
_vectors = _ristretto255_vectors()
_base = bytes.fromhex(
"e2f2ae0a6abc4e71a884a961c500515f58e30b6aa582dd8db6a65945e08d2d76"
Expand All @@ -385,7 +383,7 @@ def test_small_multiples(self, idx, encoding):
base = Ristretto255Point(self._base)
point = Ristretto255Point.ZERO

for i in range(idx):
for __ in range(idx):
point += base

assert bytes(point) == encoding
Expand Down Expand Up @@ -612,7 +610,7 @@ def test_library_error(self):
p * 2


class TestElGamal(object):
class TestElGamal:
"""
ElGamal encryption.
"""
Expand Down Expand Up @@ -661,7 +659,7 @@ def test_el_gamal(self):
assert orig_msg == decr_msg


class TestShamir(object):
class TestShamir:
"""
Shamir's Secret Sharing
"""
Expand Down

0 comments on commit 08f49e1

Please sign in to comment.