add xmasspirit

This commit is contained in:
aaron
2021-12-03 14:48:10 +01:00
parent c8936555c9
commit f9b48e720a
9 changed files with 14344515 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/python3
import random
from math import gcd
def encrypt(dt):
mod = 256
while True:
a = random.randint(1,mod)
if gcd(a, mod) == 1: break
b = random.randint(1,mod)
res = b''
for byte in dt:
enc = (a*byte + b) % mod
res += bytes([enc])
return res
dt = open('letter.pdf', 'rb').read()
res = encrypt(dt)
f = open('encrypted.bin', 'wb')
f.write(res)
f.close()