try import and export

This commit is contained in:
2024-12-10 10:06:23 +01:00
parent f9dfcf95bf
commit 28c32dba8a
3 changed files with 15 additions and 15 deletions

View File

@@ -10,9 +10,9 @@ import string
class Vermasseln:
def oscarVermasseln(self, data):
def oscarVermasseln(self, data, local= True):
b_data = data.encode("utf-8")
cipher = self.__vermasslungsKobold()
cipher = self.__vermasslungsKobold(local)
ciphertext, tag = cipher.encrypt_and_digest(b_data)
decoded_data = [b64encode(x).decode("utf-8") for x in (ciphertext, tag)]
@@ -20,11 +20,11 @@ class Vermasseln:
return storable_data
def entschluesseln(self, data):
def entschluesseln(self, data, local= True):
try:
data_list = data.split(".")
encoded_data = [b64decode(x) for x in data_list]
cipher = self.__vermasslungsKobold()
cipher = self.__vermasslungsKobold(local)
decrypted_data = cipher.decrypt_and_verify(encoded_data[0], encoded_data[1])
decrypted_data = decrypted_data.decode("utf-8")
except (ValueError, IndexError) as e:
@@ -37,12 +37,12 @@ class Vermasseln:
return decrypted_data
def __vermasslungsKobold(self):
key = platform.processor().encode("utf-8")
def __vermasslungsKobold(self, local= True):
key = platform.processor().encode("utf-8") if local else "(==daniishtverhaftetwegensexy#)"
key = key[0:31]
hash_key = SHA256.new(key)
hashed = hash_key.digest()
nonce = platform.machine().encode("utf-8")
nonce = platform.machine().encode("utf-8") if local else "(==Uskarishtverhaftetwegensexy#)"
cipher = AES.new(hashed, AES.MODE_SIV, nonce = nonce)
return cipher