100825/tex/py100425rsagen.py

# (c) David Vajda
# python 3 - n^7, fuer n=0..9
# ... oder n^7 = x mod 55, fuer n=0..9
# ... fuer RSA Verschluesselungsuebung
# 10/04/25

def decrypt23(x):
    n=0
    y=1
    while n < 23:
        y = (y*x)%55
        n = n + 1
    print (y, end=" ")



n=0
while n <= 10:
    print (n, "^7=", n**7)
    n = n+1

n=0
while n <= 10:
    print (n, "^7=", (n**7)%55 ,"mod 55")
    n = n+1


n=0
x=28
y=1
while n < 23:
    y = (y*x)%55
    n = n + 1

print (y)


encrypted = [0, 18, 2, 28, 1, 41, 49, 1, 28, 41, 41, 25, 42, 42, 4, 1, 0, 28, 42, 18]

i = 0
while i < len (encrypted):
    decrypt23 (encrypted[i])
    i = i + 1