Skip to content
Merged
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
9 changes: 6 additions & 3 deletions src/shuffled/crypto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from abc import ABC, abstractmethod, abstractproperty
from abc import ABC, abstractmethod
from typing import Sequence

from cryptography.hazmat.backends import default_backend
Expand All @@ -9,15 +9,18 @@


class Randomizer(ABC):
@abstractproperty
@property
@abstractmethod
def domain_size(self) -> int: ...

@abstractmethod
def randomize(self, integer: int) -> int: ...


class AesRandomizer(Randomizer):
domain_size = 2**128
@property
def domain_size(self) -> int:
return 2**128

def __init__(self, key: bytes) -> None:
cipher = Cipher(algorithms.AES(key), modes.ECB(), backend=default_backend())
Expand Down