• 1-Qadam
  • 4-Qadam
  • {t} sonlar to„plamidan tasodifiy d-DESHIFRLASH kaliti tanlanadi
  • Ochiq matn shifrLASH JARAYONI
  • DESHIFRLASH JARAYONI
  • #DESHIFRLASH KODINI HARFLARGA O„GIRISH




    Download 4,2 Mb.
    bet45/96
    Sana30.07.2024
    Hajmi4,2 Mb.
    #268923
    1   ...   41   42   43   44   45   46   47   48   ...   96
    Bog'liq
    Axborot xavfsizligi 2022 (1)

    #DESHIFRLASH KODINI HARFLARGA O„GIRISH


    s0="" s1="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    for t in range (0,l): z=deshifrmatn[t]-1 s0=s0+s1[z]
    print(s0)


    RSA FAYL BILAN ISHLASHGA MO„JALLANGAN DASTURI:


    fin = open("input.txt")
    fout = open("output.txt","w") s = fin.readline()
    l=len(s)
    print("Matn uzunligi:",l)


    #1-Qadam


    print('p tub son kiriting! p:=') p=int(input())
    print('q tub son kiriting! q:=') q=int(input())


    #2-Qadam


    # n ni aniqlaymiz n=p*q print('n=',n)


    #3-Qadam


    #Eyler formulasidan m ni aniqlaymiz
    m=(p-1)*(q-1)
    print('m=',m)


    #4-Qadam


    # m bilan o„zoro tub bo„lgan {t} sonlar to„plami aniqlanadi
    t=[]
    for i in range (1,m+1): k=0
    for j in range (1,i+1): if i%j==0:
    k=k+1 if k==2:
    if m%i!=0: t.append(i)
    print("d=",t)


    # {t} sonlar to„plamidan tasodifiy d-DESHIFRLASH kaliti tanlanadi


    import random d=random.choice(t)
    print("Deifrlash kaliti tanlanadi(d;n):=",d,";",n)

    #5-Qadam


    # (e*d mod m=1) tenglamadan e-SHIFRLASH kaliti topiladi
    e=1
    while (e*d%m!=1)or(e==d): e=e+1
    print("Sifrlash kaliti (e;n):=",e,";",n)


    #Ochiq matn shifrLASH JARAYONI


    index=[] shifrmatn=[] shifrmatn2=""

    for t in range (0,l): x = ord(s[t]) index.append(x) y=x**e%n


    shifrmatn.append(y) shifrmatn2+=bin(y)
    print("index:",index) print("shifrmatn:",shifrmatn) print("shifrmatn2:",shifrmatn2) print("Shifrlash muofoqiyatli bajarildi!!!")


    #DESHIFRLASH JARAYONI


    deshifrmatn=[] s=shifrmatn
    for t in range (0,l): y=int(s[t])**d%n deshifrmatn.append(y)
    print("deshifrmatn:",deshifrmatn)



    Download 4,2 Mb.
    1   ...   41   42   43   44   45   46   47   48   ...   96




    Download 4,2 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    #DESHIFRLASH KODINI HARFLARGA O„GIRISH

    Download 4,2 Mb.