Amaliy ish Ishdan maqsad: Chiziqli teskari aloqali registrlarni ishlashi haqida bilim ko‘nikmalarga EGA bo‘lish. Abduqosimov Shoxzamon #10001 00000 00101 01000 10000 01110 10101 10001 00000 00101 01000 10000 0111

|
Amaliy ish Ishdan maqsad: Chiziqli teskari aloqali registrlarni ishlashi haqida bilim ko‘nikmalarga EGA bo‘lish. Abduqosimov Shoxzamon #10001 00000 00101 01000 10000 01110 10101 10001 00000 00101 01000 10000 0111
|
bet | 1/3 | Sana | 09.07.2024 | Hajmi | 2,29 Mb. | | #267172 |
Bog'liq Shoxzamon
Muhammad al - Xorazmiy nomidagi Toshkent axborot texnologiyalari universiteti
Kiberxavfsizlik fakulteti talabasi Abduqosimov Shoxzamon
Amaliy ishi
Topshiriq
Ko‘phadlar ustida qo‘shish, ko‘paytirish, bo‘lish amallari bajarilsin:
1 0 1 1 1 0 1 0 1 1 =
1 1 0 1 0 1=
1-ish : Qo’shish
Javob:
2-ish : Ko’paytirish
ushbu ko’p hadga bo’linadi
3-ish : Bo’lish
Javob:
Amaliy ish
Ishdan maqsad: Chiziqli teskari aloqali registrlarni ishlashi haqida bilim ko‘nikmalarga ega bo‘lish.
Abduqosimov Shoxzamon
Abduqosimov Shoxzamon #10001 00000 00101 01000 10000 01110 10101 10001 00000 00101 01000 10000 0111
1* X=01110 00011 01000 010119 bit;
Y=1 01110 10101 01110 00011 0 22 bit;
Z=1000 01011 01110 10101 1101 23 bit;
Majority m =maj(x8,y10,z10)=(1,1,1)=1;
1)X8=1 m ga teng o’zgaradi;
2) Y10=1 m ga teng o’zgaradi;
3)Z10=1m ga teng o’zgarmaydi:
tx=x13x16x17x18=0100=0;
ty=y20y21=01=1;
t(z)=1
KALIT- K=x18y21z22=101=0 K1=0;
2* X=0 01110 00011 01000 01019 bit;
Y=11 01110 10101 01110 00011 22 bit;
Z=1 1000 01011 01110 10101 110 23 bit;
Majority m =maj(x8,y10,z10)=(0,0,0)=0;
1)X8=0 m ga teng o’zgarmaydi;
2) Y10=0 m ga teng o’zgaradi;
3)Z10=0m ga teng o’zgaradi:
ty=y20y21=11=0;
tz=z7z20z21z22=0101=0;
t(x)=1
KALIT- K=x18y21z22=010=1 K2=1;
3* * X=10 01110 00011 01000 0119 bit;
Y=011 01110 10101 01110 0001 22 bit;
Z=01 1000 01011 01110 10101 11 23 bit;
Majority m =maj(x8,y10,z10)=(0,1,1)=1;
1)X8=0 m ga teng ozgarmaydi;
2) Y10=1 m ga teng o’zgaradi;
3)Z10=1m ga teng o’zgaradi;
t(y)=1
t(z)=0
tz=z7z20z21z22=101=0;
KALIT- K=x18y21z22=001=1 K3=1;
4* * X=1001 1100 0011 0100 00119 bit;
Y=1011 0111 0 1 0101 01110 000 22 bit;
Z=0011 0000 1011 0111 0101 011 23 bit;
Majority m =maj(x8,y10,z10)=(0,1,0)=0;
1)X8=0 m ga teng o’zgaradi;
2) Y10=1 m ga teng o’zgarmaydi;
3)Z10=0m ga teng o’zgaradi:
tx=x13x16x17x18=0000=0;
tz=z7z20z21z22=0011=0;
KALIT- K=x18y21z22=101=0 K4=0;
5* X=0 1001 1100 0011 0100 0019 bit;
Y=1011 0111 0 1 0101 01110 000 22 bit;
Z=0 0011 0000 1011 0111 0101 01 23 bit;
Majority m =maj(x8,y10,z10)=(0,0,0)=0;
1)X8=0 m ga teng o’zgaradi;
2) Y10=1 m ga teng o’zgaradi;
3)Z10=0m ga teng o’zgaradi:
tx=x13x16x17x18=0000=0;
tz=z7z20z21z22=0010=1;
t(y)= 00=0
KALIT- K=x18y21z22=001=1 K5=1;
A = 01110 bo’lsa
01101+01110 = 00011 = D
RSA bo’yicha O harfini va D harfini shifrlaymiz.
#include
#include
#include
#include
using namespace std;
int x, y, n, t, i, flag;
long int e[50], d[50], temp[50], j;
char en[50], m[50];
char msg[100];
int asal(long int);
void shifrlash();
long int ekuk(long int);
void shifr();
void deshifr();
int main()
{
cout << "\nBIRINCHI ASAL SONNI KIRITING \nP = ";
cin >> x;
flag = asal(x);
if(flag == 0)
{
cout << "\nNOTO'G'RI KIRITISH\n";
exit(0);
}
cout << "\nIKKINCHI SONNI KIRITING\n Q = ";
cin >> y;
flag = asal(y);
if(flag == 0 || x == y)
{
cout << "\nNOTO'G'RI KIRITISH\n";
exit(0);
}
cout << "\nSHIFRLENISH UCHUN XABAR YOKI MATNNI KIRITING\n";
cin >> msg;
for(i = 0; msg[i] != NULL; i++)
m[i] = msg[i];
n = x * y;
t = (x - 1) * (y - 1);
shifrlash();
cout << "\nMUMKIN BO'LGAN e VA d QIYMATLARI\n";
for(i = 0; i < j - 1; i++)
cout << "\n" << e[i] << "\t" << d[i];
shifr();
deshifr();
return 0;
}
int asal(long int pr)
{
int i;
j = sqrt(pr);
for(i = 2; i <= j; i++)
{
if(pr % i == 0)
return 0;
}
return 1;
}
void shifrlash()
{
int k;
k = 0;
for(i = 2; i < t; i++)
{
if(t % i == 0)
continue;
flag = asal(i);
if(flag == 1 && i != x && i != y)
{
e[k] = i;
flag = ekuk(e[k]);
if(flag > 0)
{
d[k] = flag;
k++;
}
if(k == 99)
break;
}
}
}
long int ekuk(long int a)
{
long int k = 1;
while(1)
{
k = k + t;
if(k % a == 0)
return(k/a);
}
}
void shifr()
{
long int pt, ct, key = e[0], k, len;
i = 0;
len = strlen(msg);
while(i != len)
{
pt = m[i];
pt = pt - 96;
k = 1;
for(j = 0; j < key; j++)
{
k = k * pt;
k = k % n;
}
temp[i] = k;
ct= k + 96;
en[i] = ct;
i++;
}
en[i] = -1;
cout << "\n\nSHIFRLENGAN XABAR\n";
for(i=0; en[i] != -1; i++)
cout << en[i];
}
void deshifr()
{
long int pt, ct, key = d[0], k;
i = 0;
while(en[i] != -1)
{
ct = temp[i];
k = 1;
for(j = 0; j < key; j++)
{
k = k * ct;
k = k % n;
}
pt = k + 96;
m[i] = pt;
i++;
}
m[i] = -1;
cout << "\n\nDESHIFRLENGAN XABAR\n";
for(i = 0; m[i] != -1; i++)
cout << m[i];
cout << endl;
}
p=3 , q=7
e=5 d=5
e=11 d=11
A harfini shifrlanishi ---->>>> [
SH harfini shifrlanishi ---->>>> Y
OCHIQ KALITLI KRIPTOLIZMLAR. RSA ALGORITM
T0= Abduqosimov
p=3 va q=11
2)n=p*q=3*11=33
3)f(n)=(p-1)(q-1)=2*10=20
4) e soni ixtiyoriy va f(n) bilan tub bo’lishi kerak!
e=7;
5) e*d (mod(f(n))=1;
7*d(mod20)=1
d=3
{e,n} =barchaga ochiq kalit hisoblanadi.
d---->> esa maxfiy kalit ya’ni deshifrlash uchun ishlatiladi.
A
|
B
|
D
|
U
|
Q
|
O
|
S
|
I
|
M
|
O
|
V
|
15
|
4
|
9
|
12
|
15
|
|
|
|
|
22
|
|
SHIFRLASH FORMULASI f(x)=pow(x,e)(modn)
x=15 sh1=pow(15,7)(mod33)=27
x=4 sh2=pow(4,7)(mod33)=16
x=9 sh3=pow(9,7)(mod33)=15
x=12 sh4=pow(12,7)(mod33)=12
x=15 sh5=pow(15,7)(mod33)=27
x=22 sh6=pow(22,7)(mod33)=22
27
|
16
|
15
|
12
|
27
|
22
|
!
|
Q
|
P
|
M
|
!
|
W
|
DESHIFRLAYMIZ
y=27 D1=pow(27,3)mod(33)=15
y=16 D1=pow(16,3)mod(33)=4
y=15 D1=pow(15,3)mod(33)=9
y=12 D1=pow(12,3)mod(33)=12
y=27 D1=pow(27,3)mod(33)=15
y=22 D1=pow(22,3)mod(33)=22
NATIJA :
A 5/1 MA’LUMOTNI SHIFRLASH ALGORITMI
T0= Abduqosimov
Abduqosimov#
amaliy ish
Ishdan maqsad: Psevdotasodifiy sonlar generatorlar haqida bilim ko‘nikmalarga ega bo‘lish.
X1=(7*X03+7*X02+7*X0+5)mod29;
X0=boshlang’ich son X0=2;
X1=103mod29=16(10) = 10000
X2==(7*X13+7*X12+7*X1+5)mod29;
X2= 15=1111
X3=14=1110
Bunda psevdotasodifiy generatsiyada faqat 10000 1111 1110 11101 11100……. lardan tashkil topgan bo’ladi.
Dastur kodi faqat alfavitda RC4 96 talik olingan
#include
#include
class RC4 {
private:
std::vector S;
int i;
int j;
public:
RC4(std::vector key) {
S.resize(256);
for (int i = 0; i < 256; ++i) {
S[i] = i;
}
j = 0;
for (int i = 0; i < 256; ++i) {
j = (j + S[i] + key[i % key.size()]) % 256;
std::swap(S[i], S[j]);
}
i = j = 0;
}
int generateByte() {
i = (i + 1) % 256;
j = (j + S[i]) % 256;
std::swap(S[i], S[j]);
return S[(S[i] + S[j]) % 256];
}
std::vector encrypt(std::vector plaintext) {
std::vector ciphertext;
for (int byte : plaintext) {
int keystreamByte = generateByte();
ciphertext.push_back(byte ^ keystreamByte);
}
return ciphertext;
}
std::vector decrypt(std::vector ciphertext) {
return encrypt(ciphertext);
}
};
int main() {
std::vector key = {0x2B, 0x2B, 0x3C, 0x4D, 0x5E};
std::vector plaintext = {0x61, 0x62, 0x63, 0x64, 0x65};
RC4 rc4(key);
std::vector ciphertext = rc4.encrypt(plaintext);
std::vector decryptedText = rc4.decrypt(ciphertext);
std::cout << "Original Plaintext: ";
for (int byte : plaintext) {
std::cout << std::hex << byte << " ";
}
std::cout << std::endl;
std::cout << "Encrypted Ciphertext: ";
for (int byte : ciphertext) {
std::cout << std::hex << byte << " ";
}
std::cout << std::endl;
std::cout << "Decrypted Plaintext: ";
for (int byte : decryptedText) {
std::cout << std::hex << byte << " ";
}
std::cout << std::endl;
return 0;
}
amaliy ish
Ishdan maqsad: A5/1 shifrlash algoritmi yordamida ma’lumotlarni shifrlash jarayonini amalga oshirish bo’yicha nazariy va amaliy ko’nikmalarga ega bo’lish.
Abduqosimov Shoxzamon#10001 00000 00101 01000 10000 01110 10101 10001 00000 00101 01000 10000 0111
1* X=01110 00011 01000 010119 bit;
Y=1 01110 10101 01110 00011 0 22 bit;
Z=1000 01011 01110 10101 1101 23 bit;
Majority m =maj(x8,y10,z10)=(1,1,1)=1;
1)X8=1 m ga teng o’zgaradi;
2) Y10=1 m ga teng o’zgaradi;
3)Z10=1m ga teng o’zgarmaydi:
tx=x13x16x17x18=0100=0;
ty=y20y21=01=1;
t(z)=1
KALIT- K=x18y21z22=101=0 K1=0;
2* X=0
|
|
Bosh sahifa
Aloqalar
Bosh sahifa
Amaliy ish Ishdan maqsad: Chiziqli teskari aloqali registrlarni ishlashi haqida bilim ko‘nikmalarga EGA bo‘lish. Abduqosimov Shoxzamon #10001 00000 00101 01000 10000 01110 10101 10001 00000 00101 01000 10000 0111
|