@Zertyazertyu/

Chiffrement Test

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from math import log 

def int_to_bytes(value, length):
  result = []
  for i in range(0, length):
    result.append(value >> (i * 8) & 0xff)
    result.reverse()
    return result


def suXor(data,key):
  oldKey = key
  while len(data)>len(key):key+=oldKey
  oldKey = len(data)-len(key)
  if oldKey:key = key[:oldKey]
  data = int.from_bytes(data.encode(),"big")^int.from_bytes(key.encode(),"big")
  data = data.to_bytes((int(log(data, 2.0))//8)+1,"big")
  return data.decode()


key ="urhsoihqzhurhedzohrgouhfieqshrih787T7zàçeupdoiye!çgdzuç,fugn!eybrc!çbr^çze^àçyà(ç!èy!(!cèaç^'t  ^péài,^épaçunoiyrc!ebytçez(ètàçy(cziucnvbtoy')"
a= suXor("Hey my name is marcus ! et j'aime les trains aussi c'est assez cool wooooaaaaaaahhh",key)
b = suXor(a,key)
print(b)