Python can transform letter to their index which is inside of the utf-8 table
ord('a') -> 97
chr(97) -> 'a'
Simplified explainations:
- text -> list
text = list(text)
"hello" -> ['h', 'e', 'l', 'l', 'o']
- each char -> ord(char)
ord('h') -> 104
- apply mathematical operations on the obtained number with modifiers
104 -> 108 (+4)
- return joined text
'.'.join(text)
["108", "105", "112", "112", "116"] -> "108.105.112.112.116"
- repeat 1, 2, 3 and 4 for number of required turns
You have at your disposition these function:
- seed
- encrypt
- decrypt
- transform
- untransform
- combinations
import chrend
# all the allowed (operators, values): chrend.OPERATORS, chrend.CONV
seed = chrend.seed(turns=1, modifiers=[("+", "%l"), ("*", 2)])
print(seed)
encrypted = chrend.encrypt('hello ma boi :)', seed=seed)
print(repr(encrypted))
tencrypted = chrend.transform(encrypted)
print(repr(tencrypted))
encrypted = chrend.untransform(tencrypted)
print(repr(encrypted))
decrypted = chrend.decrypt(encrypted, seed=seed)
print(repr(decrypted))
Seeds works like in minecraft:
But be careful, modifiers are math operations so one modifier can be equal to another. Example bellow
import chrend
seed_one = chrend.seed(turns=1, modifiers=[("<<", 4)])
# 0x1a4b5
seed_two = chrend.seed(turns=3, modifiers=[("*", 16)])
# 0x1a16b2
encrypted_one = chrend.encrypt('text', seed=seed_one)
encrypted_two = chrend.encrypt('text', seed=seed_two)
print(encrypted_one == encrypted_two)
# shows: True