numpy refactor
This commit is contained in:
10
src/user.py
10
src/user.py
@@ -1,9 +1,11 @@
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import numpy as np
|
||||
|
||||
from src.models import EncipheredNKode
|
||||
from src.customer_cipher import CustomerCipher
|
||||
from src.user_cipher import UserCipher
|
||||
from src.user_keypad import UserKeypad
|
||||
from src.utils import xor_lists
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -14,10 +16,10 @@ class User:
|
||||
user_keypad: UserKeypad
|
||||
renew: bool = field(default=False)
|
||||
|
||||
def renew_keys(self, set_xor: list[int], prop_xor: list[int]):
|
||||
def renew_keys(self, set_xor: np.ndarray, prop_xor: np.ndarray):
|
||||
self.renew = True
|
||||
self.cipher.set_key = xor_lists(self.cipher.set_key, set_xor)
|
||||
self.cipher.prop_key = xor_lists(self.cipher.prop_key, prop_xor)
|
||||
self.cipher.set_key = np.bitwise_xor(self.cipher.set_key, set_xor)
|
||||
self.cipher.prop_key = np.bitwise_xor(self.cipher.prop_key, prop_xor)
|
||||
|
||||
def refresh_passcode(self, passcode_attr_idx: list[int], customer_attributes: CustomerCipher):
|
||||
self.cipher = UserCipher.create(
|
||||
|
||||
Reference in New Issue
Block a user