Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ENCRYPT_NUMBER(BASE, INPUT):
- return ((BASE[0] * 2) + 1) * (2 ** (0 if INPUT < 0 else INPUT)), ((BASE[1] * 2) + 1) * (2 ** ((INPUT * -1) if INPUT < 0 else 0))
- # TODO: DECRYPT WITHOUT ITERATION OR RECURSION
- def DECRYPT_BASE(BASE):
- BASE_BIT = 0
- while BASE % 2 == 0:
- BASE = BASE / 2
- BASE_BIT = BASE_BIT + 1
- BASE = (BASE - 1) / 2
- return BASE, BASE_BIT
- def DECRYPT_NUMBER(BASE):
- POSITIVE_BASE = BASE[0]
- NEGATIVE_BASE = BASE[1]
- POSITIVE_BASE,POSITIVE_BIT = DECRYPT_BASE(POSITIVE_BASE)
- NEGATIVE_BASE,NEGATIVE_BIT = DECRYPT_BASE(NEGATIVE_BASE)
- return tuple([POSITIVE_BASE,NEGATIVE_BASE]), POSITIVE_BIT - NEGATIVE_BIT
- def REVERSE_ENCRYPTION(BASE):
- POSITIVE_BASE = BASE[0]
- NEGATIVE_BASE = BASE[1]
- ENCRYPTION = (0,0)
- while POSITIVE_BASE > 0 or NEGATIVE_BASE > 0:
- BASE, BIT = DECRYPT_NUMBER(BASE)
- POSITIVE_BASE, NEGATIVE_BASE = BASE
- ENCRYPTION = ENCRYPT_NUMBER(ENCRYPTION, BIT)
- return ENCRYPTION
- BASE = (0, 0)
- BASE = ENCRYPT_NUMBER(BASE, 0)
- BASE = ENCRYPT_NUMBER(BASE, 1)
- BASE = ENCRYPT_NUMBER(BASE, 2)
- BASE = ENCRYPT_NUMBER(BASE, 3)
- BASE = ENCRYPT_NUMBER(BASE, 4)
- BASE = ENCRYPT_NUMBER(BASE, 5)
- BASE = ENCRYPT_NUMBER(BASE, -6)
- BASE = ENCRYPT_NUMBER(BASE, -7)
- BASE = ENCRYPT_NUMBER(BASE, -8)
- BASE = ENCRYPT_NUMBER(BASE, 9)
- BASE = ENCRYPT_NUMBER(BASE, -10)
- BASE = REVERSE_ENCRYPTION(BASE)
- POSITIVE,NEGATIVE = BASE
- while POSITIVE > 0 or NEGATIVE > 0:
- BASE,DECRYPTED= DECRYPT_NUMBER(BASE)
- POSITIVE,NEGATIVE = BASE
- print("POSITIVE_ENCRYPTION: " + str(POSITIVE) + ", NEGATIVE_ENCRYPTION: " + str(NEGATIVE) + ", DECRYPTED: " + str(DECRYPTED))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement