formatte file

This commit is contained in:
2025-04-01 14:28:43 +02:00
parent f2ae2cbc13
commit e03e5458aa
77 changed files with 1231 additions and 945 deletions

View File

@@ -7,18 +7,22 @@ def est_premier(n):
return False
return True
def liste_premier_inf(n):
return [i for i in range(2, n+1) if est_premier(i)]
return [i for i in range(2, n + 1) if est_premier(i)]
def pgcd(a, b):
while b:
a, b = b, a % b
return a
def cle_publique_possible(a, b):
n = a * b
return [i for i in range(1, n) if pgcd(i, n) == 1]
def inverse(e, n):
t, newt = 0, 1
r, newr = n, e
@@ -32,17 +36,23 @@ def inverse(e, n):
t += n
return t
def chaine_en_liste(chaine):
return [ord(c) for c in chaine]
def chiffre(e, N, liste):
return [pow(x, e, N) for x in liste]
def dechiffre(d, N, liste):
return [pow(x, d, N) for x in liste]
def liste_en_chaine(liste):
return ''.join(chr(x) for x in liste)
return "".join(chr(x) for x in liste)
cle = 17873
a, b = 61, 53
N = a * b