# https://github.com/nyaanity/Lockit
from binascii import hexlify, unhexlify


class HEX:
    def __init__(self, text: str, secret: str):
        self.secret = secret
        self.text = text
        self.data = None

    @staticmethod
    def rawEncrypt(text: str, secret: str) -> "HEX":
        byted_text = text.encode("utf-8")
        byted_secret = secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        data = hex(encrypted_int).upper().replace("0X", "0x")
        return data

    @staticmethod
    def rawDecrypt(data: str, secret: str) -> str:
        byted_secret = secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(data[2:], 16)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        data = decrypted_text.decode("utf-8")
        return data

    def encrypt(self) -> "HEX":
        byted_text = self.text.encode("utf-8")
        byted_secret = self.secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        self.data = hex(encrypted_int).upper().replace("0X", "0x")
        return self

    def decrypt(self) -> "HEX":
        byted_secret = self.secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(self.data[2:], 16)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        self.data = decrypted_text.decode("utf-8")
        return self


class ID:
    def __init__(self, text: str, secret: str):
        self.secret = secret
        self.text = text
        self.data = None

    @staticmethod
    def rawEncrypt(text: str, secret: str) -> str:
        byted_text = text.encode("utf-8")
        byted_secret = secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        data = encrypted_int
        return data

    @staticmethod
    def rawDecrypt(data: str, secret: str) -> str:
        byted_secret = secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(data)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        data = decrypted_text.decode("utf-8")
        return data

    def encrypt(self) -> "ID":
        byted_text = self.text.encode("utf-8")
        byted_secret = self.secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        self.data = encrypted_int
        return self

    def decrypt(self) -> "ID":
        byted_secret = self.secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(self.data)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        self.data = decrypted_text.decode("utf-8")
        return self

# https://github.com/nyaanity/Lockit
from binascii import hexlify, unhexlify


class HEX:
    def __init__(self, text: str, secret: str):
        self.secret = secret
        self.text = text
        self.data = None

    @staticmethod
    def rawEncrypt(text: str, secret: str) -> "HEX":
        byted_text = text.encode("utf-8")
        byted_secret = secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        data = hex(encrypted_int).upper().replace("0X", "0x")
        return data

    @staticmethod
    def rawDecrypt(data: str, secret: str) -> str:
        byted_secret = secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(data[2:], 16)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        data = decrypted_text.decode("utf-8")
        return data

    def encrypt(self) -> "HEX":
        byted_text = self.text.encode("utf-8")
        byted_secret = self.secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        self.data = hex(encrypted_int).upper().replace("0X", "0x")
        return self

    def decrypt(self) -> "HEX":
        byted_secret = self.secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(self.data[2:], 16)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        self.data = decrypted_text.decode("utf-8")
        return self


class ID:
    def __init__(self, text: str, secret: str):
        self.secret = secret
        self.text = text
        self.data = None

    @staticmethod
    def rawEncrypt(text: str, secret: str) -> str:
        byted_text = text.encode("utf-8")
        byted_secret = secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        data = encrypted_int
        return data

    @staticmethod
    def rawDecrypt(data: str, secret: str) -> str:
        byted_secret = secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(data)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        data = decrypted_text.decode("utf-8")
        return data

    def encrypt(self) -> "ID":
        byted_text = self.text.encode("utf-8")
        byted_secret = self.secret.encode("utf-8")
        hexlified_text = hexlify(byted_text)
        hexlified_secret = hexlify(byted_secret)
        inted_text = int(hexlified_text, 16)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = inted_text ^ inted_secret // 0xC0FFEE
        self.data = encrypted_int
        return self

    def decrypt(self) -> "ID":
        byted_secret = self.secret.encode("utf-8")
        hexlified_secret = hexlify(byted_secret)
        inted_secret = int(hexlified_secret, 16)
        encrypted_int = int(self.data)
        decrypted_int = encrypted_int ^ inted_secret // 0xC0FFEE
        decrypted_text = unhexlify(f"{decrypted_int:x}")
        self.data = decrypted_text.decode("utf-8")
        return self

# https://github.com/nyaanity/Lockit