Analitik usıllarǵa tiykarlanǵan shifrlaw algoritminiń dástúri
Shifrlaw kodı:
#include
using namespace std;
int main()
{
int a,b,c,d=1;
cout << "A-matritsanin olshemi: ";
cin >> a;
b = a; c = a;
string s;
cout << "\nTekst: ";
cin >> s;
int S1[a][d],S2[a][d];
int C1[a][d],C2[a][d];
cout << "\nHariplerdin tartip nomeri: \n";
for(int i=0; ifor(int j=0; jcin >> S1[i][j];
}
for(int i=0; ifor(int j=0; jcin >> S2[i][j];
}
int A[a][b];
cout << "\nA-matritsa: \n";
for(int i=0; ifor(int j=0; jcin >> A[i][j];
}
}
for(int i=0; ifor(int j=0; jC1[i][j] = 0;
C2[i][j] = 0;
}
}
for(int i=0; ifor(int j=0; jfor(int m=0; mC1[i][j] += A[i][m]*S1[m][j];
}
}
}
for(int i=0; ifor(int j=0; jfor(int m=0; mC2[i][j] += A[i][m]*S2[m][j];
}
}
}
cout << "\nShifrlangan tekst: ";
for(int i=0; ifor(int j=0; jcout << C1[i][j] << " ";
}
}
for(int i=0; ifor(int j=0; jcout << C2[i][j] << " ";
}
}
return 0;
}
Nátiyje:
Deshifrlaw kodı:
#include
using namespace std;
int main()
{
int a = 2, b= 2, c = 2, d = 1;
double S1[a][d],S2[a][d];
double C1[a][d],C2[a][d];
cout << "Shifrlangan tekstti kiritin: ";
for(int i=0; ifor(int j=0; jcin >> C1[i][j];
}
for(int i=0; ifor(int j=0; jcin >> C2[i][j];
}
for(int i=0; ifor(int j=0; jS1[i][j] = 0;
S2[i][j] = 0;
} }
int A[a][b];
cout << "\nA-matritsa: \n";
for(int i=0; ifor(int j=0; jcin >> A[i][j];
}
}
double delta_A = A[0][0]*A[1][1]-A[0][1]*A[1][0];
int A_T[a][b];
A_T[0][0] = A[1][1];
A_T[1][0] = -A[1][0];
A_T[0][1] = -A[0][1];
A_T[1][1] = A[0][0];
double A_1[a][b];
for(int i=0; ifor(int j=0; jA_1[i][j] = double(A_T[i][j])/delta_A;
}
}
for(int i=0; ifor(int j=0; jfor(int m=0; mS1[i][j] += A_1[i][m]*C1[m][j];
}
}
}
for(int i=0; i
for(int j=0; jfor(int m=0; mS2[i][j] += A_1[i][m]*C2[m][j];
}
}
}
cout << "\nNatiyje: ";
for(int i=0; ifor(int j=0; jcout << S1[i][j] << " ";
}
}
for(int i=0; ifor(int j=0; jcout << S2[i][j] << " ";
}
}
return 0;
}
Nátiyje:__RSA_algoritmine_tiykarlanǵan_shifrlaw_dástúri_Shifrlanıw_kodı'>Nátiyje:
RSA algoritmine tiykarlanǵan shifrlaw dástúri
Shifrlanıw kodı:
#include
#include
#include
using namespace std;
int main()
{
long int p,q,n,d,e,a[100],A[100],k=1,f;
string s;
cout<<"Sozdi kiritin = "; getline(cin,s);
cout<<"\n Qalegen p ham q apiwayi sanlardi kiritin = "; cin>>p>>q;
n=p*q;
f=(p-1)*(q-1);
for(int i=0; ia[i]=int(s[i]);
}
cout << endl;
for(int i=0; iif(a[i]>=97 && a[i]<=122)
cout<else
cout << a[i]-64 << " ";
}
for(int i=0; iif(s[i]==' ') a[i]=0;
else
if(a[i]>=97 && a[i]<=122)
a[i]=int(s[i]-96);
else
a[i]=int(s[i]-64);
}
cout<cout<<"Jasirin gilt e ni kiritin = "; cin>>e;
for(int i=1; i<=1000; i++){
if( (e*i)%f==1) {
d=i;
break;
}
}
cout<<"\n\n-------------------------------------------------\n\n";
cout<<" Shifrlangan magliwmatlar \n"<
for(int i=0; i
int k=1;
for(int j=1; j<=e; j++){
k=k*a[i];
k=k%n;
}
A[i]=k;
}
for(int i=0; icout<}
cout<for(int i=0; icout<}
cout<system("PAUSE");
return 0;
}
Nátiyje:____Cezar_shifrlaw_usılı_dástúri_Shifrlaw_kodı'>Nátiyje:______Deshifrlaw_kodı'>Nátiyje:
Deshifrlanıw kodı:
#include
#include
#include
using namespace std;
int main()
{
long int n,d,a[100],A[100],k=1;
string s;
cout<<"\nShifrlangan tekstti kiritin = "; getline(cin,s);
cout<<"\nJasirin d ham n giltlerin kiritin = "; cin>>d>>n;
for(int i=0; ia[i]=int(s[i]);
}
cout << endl;
for(int i=0; iif(a[i]>=97 && a[i]<=122)
cout<else
cout << a[i]-64 << " ";
}
for(int i=0; iif(s[i]==' ') a[i]=0;
else
if(a[i]>=97 && a[i]<=122)
a[i]=int(s[i]-96);
else
a[i]=int(s[i]-64);
}
cout<<"\n\n\---------------------------------------------\n\n";
for(int i=0; iint k=1;
for(int j=1; j<=d; j++){
k=k*a[i];
k=k%n;
}
A[i]=k;
}
cout<<"\nHaqiyqiy tekst = ";
for(int i=0; icout<}
cout << endl << endl;
for(int i=0; icout<}
cout<cout << endl << endl;
system("PAUSE");
return 0;
}
Nátiyje :
Vijiner tablicası járdeminde maǵlıwmatlardı shifrlaw dástúri
Shifrlaw kodı:
package vijinertablicasishifrlaw;
import java.util.Scanner;
public class Vijinertablicasishifrlaw {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String a,b; int c;
System.out.println(" Shifrlaw");
System.out.print("Tekstti kiritin' : ");
a=in.nextLine();
System.out.print("Gilt so'zin kiritin' : ");
b=in.nextLine(); c=0;
for(int i=0;iif((int)a.charAt(i)+(int)b.charAt(i)-192<28){
c=(int)a.charAt(i)+(int)b.charAt(i)-97; }
else c=(int)a.charAt(i)+(int)b.charAt(i)-123;
System.out.print((char)c);
}
System.out.println();
}
}
Nátiyje:
Deshifrlaw kodı:
package vijinertablicasideshifrlaw;
import java.util.Scanner;
public class Vijinertablicasideshifrlaw {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String a,b; int c=0;
System.out.println("Deshifrlaw");
System.out.print("Shifrtekstti kiritin' : ");
a=in.nextLine();
System.out.print("Gilt so'zin kiritin' : ");
b=in.nextLine(); c=0;
for(int i=0;iif((int)a.charAt(i)-(int)b.charAt(i)+97>96){
c=(int)a.charAt(i)-(int)b.charAt(i)+97; }
else c=(int)a.charAt(i)-(int)b.charAt(i)+123;
System.out.print((char)c);
}
System.out.println();
}
}
Nátiyje:
Cezar shifrlaw usılı dástúri
Shifrlaw kodı:
package cezarshifrlaw;
import java.util.Scanner;
public class CezarShifrlaw {
public static void main(String[] args) {
System.out.println("CEZAR USILINDA SHIFRLAW");
Scanner in=new Scanner(System.in);
String s; int n;
System.out.print("Tekstti kiritin' : "); s=in.next();
System.out.print("Gilt sandi kiritin' : "); n=in.nextInt();
if(n>=3){ for(int i=0; iif((char)(n+(int)s.charAt(i))>64 && (char)(n+(int)s.charAt(i))<90
|| (char)(n+(int)s.charAt(i))>97 && (char)(n+(int)s.charAt(i))<123){
System.out.print((char)(n+(int)s.charAt(i)));}
else if(s.charAt(i)<=90)
System.out.print((char)(n+(int)s.charAt(i)-26));
else if(s.charAt(i)<=122)
System.out.print((char)(n+(int)s.charAt(i)-26)); } }
else System.out.print("U'lkenirek gilt kiritin' : ");
System.out.println();
}
}
Nátiyje:
Deshifrlaw kodı:
package cezardeshifrlaw;
import java.util.Scanner;
public class CezarDeshifrlaw {
public static void main(String[] args) {
System.out.println("CEZAR USILINDA DESHIFRLAW");
Scanner in=new Scanner(System.in);
String s; int n,b=0;
System.out.print("Tekstti kiritin' : "); s=in.next();
System.out.print("Gilt sandi kiritin' : "); n=in.nextInt();
if(n>=3){ for(int i=0; iif((int)s.charAt(i)-n < 97)
b=(int)s.charAt(i)+23-n;
else b=(int)s.charAt(i)-n;
System.out.print((char)b);}}
else { System.out.println("U'lkenirek gilt kiritin' : ");}
System.out.println();
}
}
Nátiyje:
Simmetriyalı orın almastırıw járdeminde shifrlaw
Shifrlaw kodı:
package orinalmastiriwshifrlaw;
import java.util.Scanner;
public class Orinalmastiriwshifrlaw {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String d,e;
System.out.println("Tuwridan tuwri orin almastiriw usilinda "
+ "shifrlaw");
int a, b, c, g=0, h=0;
System.out.print("Tekstti kiritin' : ");
System.out.println("!!!Tekst ha'riplerinin' sani jup sannan ibarat bolsin");
d=in.nextLine();
System.out.print("Ko'beymesi tekst ha'riplerinin' "
+ "sanina ten' bolg'an eki o'lshem kiritin' : ");
a=in.nextInt(); b=in.nextInt();
System.out.println("x = {"+a+","+b+"}");
for(int i=0; iSystem.out.print((char)(g)); }
for(int j=1; jif(a>=3)
for(int l=2; l{ System.out.print(d.charAt(l));}
if(a>=4) { for(int q=3; q{ System.out.print(d.charAt(q)); } }
if(a>=5) { for(int q=4; q{ System.out.print(d.charAt(q)); } }
System.out.println(); }
}
Nátiyje:
Deshifrlaw kodı:
package orinalmastiriwdeshifrlaw;
import java.util.Scanner;
public class Orinalmastiriwdeshifrlaw {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String d,e;
System.out.println("Tuwridan tuwri orin almastiriw"
+ " usilinda deshifrlaw");
int a, b, c, g=0, h=0;
System.out.print("Shifrtekstti kiritin' : "); d=in.nextLine();
System.out.print("Shifrlaniwda kiritilgen o'lshemlerdi orin "
+ "almastirip kiritin' : "); a=in.nextInt(); b=in.nextInt();
System.out.println("x = {"+a+","+b+"}");
for(int i=0; iSystem.out.print((char)(g)); }
for(int j=1; jif(a>=3)
for(int l=2; l{ System.out.print(d.charAt(l));}
if(a>=4) { for(int q=3; q{ System.out.print(d.charAt(q)); } }
if(a>=5) { for(int q=4; q{ System.out.print(d.charAt(q)); } }
System.out.println(); }
}
Nátiyje:
90>
Do'stlaringiz bilan baham: |