Tоshkеnt aхbоrоt tехnоlоgiyalari univеrsitеti kriptografiya 2 fanidan Loyiha ishi Bajardi: Ramazonov Asadbek, Ma’murjonov Zarifjon Mamaroziqov Muzaffar, Suyunov Davron, Tekshirdi: Mardiev Ulug’bek Toshkеnt – 2023


Biz 8 ta qadamda natichaga (ochiq matn) erishdik!!!


Download 11.53 Kb.
bet3/3
Sana20.08.2023
Hajmi11.53 Kb.
#1668609
1   2   3
Bog'liq
Tоshkеnt aхbоrоt tехnоlоgiyalari univеrsitеti kriptografiya 2 fa-fayllar.org (2)

Biz 8 ta qadamda natichaga (ochiq matn) erishdik!!!
ILOVA


Dastur kodi:
Ps: Biz bu kodlarni python dasturlash tilida yozdik.
#Birinchi qadam

import math


n =("3521965691682498349894156297871351510003392837134480208222044"
"4753957752560806765915557404471872854222134926440656261548716"
"5251895509139075621688493447805478090729096096693340629223579"
"5059531555148850225316762953811321830535065868925602454064437"
"6849173366230815779694365269990430445181132796913932904941185"
"478344783047790284034086549612594449881")
n=int(n)
def loyiha_ish(n):
x = 2
y = 2
boluvchi = 1
i=0
while boluvchi== 1:
x = f(x, n)
y = f(f(y, n), n)
print(f"x({i}) = {x}")
print( f"y({i}) = {y} ")
i+=1
boluvchi = math.gcd(abs(x - y), n)
print(f"EKUB(|x-y|,n)={boluvchi}")
if boluvchi == n:
return None
else:
return [boluvchi, n // boluvchi]
def f(x, n):
return (x * x + 1) % n
numbers = loyiha_ish(n)

p = numbers[0]


q = numbers[1]
print(f"p = {p}")
print(f"q = {q}")
# Keyingi qadam:

c = ("1946990934266279413917993964398835970466043305162067149027416"


"2053008128349816033069247844970800863920955661712219866590366"
"9590908102703307250646216395967327417349581565673419272952219"
"8445430968778476727718084419319887006224079130320273805411547"
"7138201099392091672934450078062438509784548210810385639731494"
"7527381565904894782921374911825451607")
q = ("3098916675463607780464997187815576730075083500253875509728393509"

"98744943685393982481905598554268594569131526106931754414514765007609"


"61938733812295783151626364715549900758671969538864637994361280253879"
"98564380005561829893471856363325810237480997216190372833199473422687"
"391969948445254019618649486619663112858167628758971855278811478871")
p = 11365151311
q=int(q)
e = 65537
c=int(c)
Ф= (p - 1) * (q - 1)

d = pow(e, -1, Ф)


print(f"Ф(n)= {Ф}")
print(f"d = {d}")
m = pow(c,d,n)
print(f"OCHIQ MATIN : M = {m}")
#Birinchi qadam

import math


n =("3521965691682498349894156297871351510003392837134480208222044"
"4753957752560806765915557404471872854222134926440656261548716"
"5251895509139075621688493447805478090729096096693340629223579"
"5059531555148850225316762953811321830535065868925602454064437"
"6849173366230815779694365269990430445181132796913932904941185"
"478344783047790284034086549612594449881")
n=int(n)
def loyiha_ish(n):
x = 2
y = 2
boluvchi = 1
i=0
while boluvchi== 1:
x = f(x, n)
y = f(f(y, n), n)
print(f"x({i}) = {x}")
print( f"y({i}) = {y} ")
i+=1
boluvchi = math.gcd(abs(x - y), n)
print(f"EKUB(|x-y|,n)={boluvchi}")
if boluvchi == n:
return None
else:
return [boluvchi, n // boluvchi]
def f(x, n):
return (x * x + 1) % n
numbers = loyiha_ish(n)

p = numbers[0]


q = numbers[1]
print(f"p = {p}")
print(f"q = {q}")
# Keyingi qadam:
c = ("1946990934266279413917993964398835970466043305162067149027416"
"2053008128349816033069247844970800863920955661712219866590366"
"9590908102703307250646216395967327417349581565673419272952219"
"8445430968778476727718084419319887006224079130320273805411547"
"7138201099392091672934450078062438509784548210810385639731494"
"7527381565904894782921374911825451607")
q = ("3098916675463607780464997187815576730075083500253875509728393509"

"98744943685393982481905598554268594569131526106931754414514765007609"


"61938733812295783151626364715549900758671969538864637994361280253879"
"98564380005561829893471856363325810237480997216190372833199473422687"
"391969948445254019618649486619663112858167628758971855278811478871")
p = 11365151311
q=int(q)
e = 65537
c=int(c)
Ф= (p - 1) * (q - 1)

d = pow(e, -1, Ф)


print(f"Ф(n)= {Ф}")
print(f"d = {d}")
m = pow(c,d,n)
print(f"OCHIQ MATIN : M = {m}")
http://fayllar.org
Download 11.53 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling