Bài tập môn An toàn Bảo mật thông tin - Thực hành phần mật mã
- Seiten
- 73
- Định dạng
- Dung lượng
- 2.1 MB
- Ngôn ngữ
- VI · Tiếng Việt
- Aufrufe
- 3.402
- Kommentare
- 0
- Lượt tải
- 2
Vorschau wird generiert...
- Dokumentenname
- Bài tập môn An toàn Bảo mật thông tin - Thực hành phần mật mã
- Inhaltsverzeichnis
- Dieses Dokument hat kein eindeutiges Inhaltsverzeichnis.
- Seiten
- 73 Seiten
- Hochgeladen von
- ThiNganHang
Eine detaillierte Zusammenfassung wird generiert. Bitte schauen Sie in ein paar Minuten noch einmal vorbei.
Beschreibung
Trích nội dung tài liệu
BÀI TẬP THỰC HÀNH PHẦN MẬT MÃ (12 tiêt) Bài 1 : Kiểm tra số nguyên tố : #include <iostream.h> #include <conio.h> void main() { clrscr(); int x , n; cout<<"nhap vao so nguyen can kiem tra: ";cin>>x; n=2; while(x%n>0) { n++; } if (n==x ) cout<<"La so nguyen to"; else cout<<"Khongla so NT"; getch(); } Bài 2 :Tạo N số nguyên tố đầu tiên #include <stdio.h> #include <math.h> #define N 100 int i,j,k; long int q,r,n,pr[N+1]; int main() { pr[1]=2;n=3;j=1; label1:j++;pr[j]=n; if (j==N) goto label4; label2: n+=2;k=2; label3: q=n/pr[k];r=n%pr[k]; if(r==0) goto label2; if (q<=pr[k]) goto label1; k++;goto label3 ; label4: for(i=1;i<=N;i++) { printf("%1d ",pr[i]); if(i%10==0) printf(" "); } getchar(); return(n,j,k); }/*main*/ Bài 3 Biểu diễn theo cơ số B /*BIEU DIEN CO SO B*/ #include<stdio.h> #include<math.h> /* input : two non_negative intergers a,b ,b>=2 output : base b representation of a */ int a,b; long repre(int a,int b); long repre0(int a,int b); void main() { a=12;b=2; repre(a,b); a=8;b=4; repre(a,b); a=15245;b=32; repre(a,b); a=748;b=16; repre(a,b); a=14;b=2; repre0(a,b); getchar(); }/* main */ long repre(int a,int b) { int n,i,A[20];long x,q; n=0;q=a/b;A[n]=a%b; while(q>0) { n++;x=q;q=x/b;A[n]=x%b; }/* end while */ printf("a=%1d b=%1d n=%1d\n " ,a,b,n); for(i=0;i<=n;i++) printf(" A[%d]=%1d\n ",i,A[i]); } /* b-representation */ long repre0(int a,int b) { int A0,A1; A0=a%b;A1=(a/b)%b; printf("a=%ld d=%1d A0=%1d A1=%1d ",a,b,A0,A1); }/* b-representation */ Bài 4 : Cộng hai số biểu diễn theo cơ số B #include<stdio.h> #include<math.h> /* input : Two positive integers x,y in base b representation output : x+y in base b representation */ long a,b,x,y,z,t; int A[100],X[100],Y[100],Z[100],i,n,N; long repre(long a,long b); long add(long x,long y); void main() { x=2748;y=659260;b=32; a=x; /*printf("a=%d b=%d x=%d y=%d \n",a,b,x,y);*/ repre(a,b); N=n; for(i=0;i<=n;i++) X[i]=A[i]; a=y;repre(a,b);if(N<n) N=n; for(i=0;i<=n;i++) Y[i]=A[i]; printf("x=%ld y=%ld b=%ld N=%d \n",x,y,b,N); for(i=0;i<=N;i++) printf("X[%d]=%d Y[%d]=%d \n",i,X[i],i,Y[i]); add(x,y); for(i=0;i<=N;i++) printf("Z[%d]=%d \n",i,Z[i]); /* verification */ z=Z[0];t=1; for(i=1;i<=N+1;i++) {t*=b;z+=(Z[i]*t);} printf("z=%ld x+y=%ld \n",z,x+y);getchar(); }/* main */ long repre(long a,long b) { long q,qq ; n=0 ; q =a/b ; A[n]=a%b ; while(q>0) {n++ ; qq=q ; q=qq/b ; A[n]=qq%b;} } /* b - representation */ long add(long x,long y) { int ii,c=0,tem; /* c is the carry digit */ for(ii=0;ii<=n;ii++) { tem=(X[ii]+Y[ii]+c); if(tem<b) {Z[ii]=tem;c=0;} else {Z[ii]=tem-b;c=1;} }/* ii */ Z[N+1]=c; }/* add */ Bài 5 Nhân hai số theo cơ số B # include<stdio.h> # include<math.h>
Häufig gestellte Fragen
Wie lade ich dieses Dokument herunter?
Das Dokument „Bài tập môn An toàn Bảo mật thông tin - Thực hành phần mật mã“ kostet 35.000đ. Laden Sie Ihr Guthaben über PayOS auf, klicken Sie dann auf Herunterladen, um die Originaldatei zu kaufen und zu speichern.
Wie viele Seiten hat dieses Dokument?
Das Dokument hat 73 Seiten. Sie können es vor dem Herunterladen online in der Vorschau ansehen.
Kann ich vor dem Herunterladen eine Vorschau ansehen?
Ja. Sie können sich dieses Dokument direkt auf dieser Seite im Online-Reader ansehen (die ersten paar Seiten) und dann entscheiden, ob Sie es herunterladen möchten.
Bài tập môn An toàn Bảo mật thông tin - Thực hành phần mật mã
Vorschau wird generiert...
Trích nội dung tài liệu
BÀI TẬP THỰC HÀNH PHẦN MẬT MÃ (12 tiêt) Bài 1 : Kiểm tra số nguyên tố : #include <iostream.h> #include <conio.h> void main() { clrscr(); int x , n; cout<<"nhap vao so nguyen can kiem tra: ";cin>>x; n=2; while(x%n>0) { n++; } if (n==x ) cout<<"La so nguyen to"; else cout<<"Khongla so NT"; getch(); } Bài 2 :Tạo N số nguyên tố đầu tiên #include <stdio.h> #include <math.h> #define N 100 int i,j,k; long int q,r,n,pr[N+1]; int main() { pr[1]=2;n=3;j=1; label1:j++;pr[j]=n; if (j==N) goto label4; label2: n+=2;k=2; label3: q=n/pr[k];r=n%pr[k]; if(r==0) goto label2; if (q<=pr[k]) goto label1; k++;goto label3 ; label4: for(i=1;i<=N;i++) { printf("%1d ",pr[i]); if(i%10==0) printf(" "); } getchar(); return(n,j,k); }/*main*/ Bài 3 Biểu diễn theo cơ số B /*BIEU DIEN CO SO B*/ #include<stdio.h> #include<math.h> /* input : two non_negative intergers a,b ,b>=2 output : base b representation of a */ int a,b; long repre(int a,int b); long repre0(int a,int b); void main() { a=12;b=2; repre(a,b); a=8;b=4; repre(a,b); a=15245;b=32; repre(a,b); a=748;b=16; repre(a,b); a=14;b=2; repre0(a,b); getchar(); }/* main */ long repre(int a,int b) { int n,i,A[20];long x,q; n=0;q=a/b;A[n]=a%b; while(q>0) { n++;x=q;q=x/b;A[n]=x%b; }/* end while */ printf("a=%1d b=%1d n=%1d\n " ,a,b,n); for(i=0;i<=n;i++) printf(" A[%d]=%1d\n ",i,A[i]); } /* b-representation */ long repre0(int a,int b) { int A0,A1; A0=a%b;A1=(a/b)%b; printf("a=%ld d=%1d A0=%1d A1=%1d ",a,b,A0,A1); }/* b-representation */ Bài 4 : Cộng hai số biểu diễn theo cơ số B #include<stdio.h> #include<math.h> /* input : Two positive integers x,y in base b representation output : x+y in base b representation */ long a,b,x,y,z,t; int A[100],X[100],Y[100],Z[100],i,n,N; long repre(long a,long b); long add(long x,long y); void main() { x=2748;y=659260;b=32; a=x; /*printf("a=%d b=%d x=%d y=%d \n",a,b,x,y);*/ repre(a,b); N=n; for(i=0;i<=n;i++) X[i]=A[i]; a=y;repre(a,b);if(N<n) N=n; for(i=0;i<=n;i++) Y[i]=A[i]; printf("x=%ld y=%ld b=%ld N=%d \n",x,y,b,N); for(i=0;i<=N;i++) printf("X[%d]=%d Y[%d]=%d \n",i,X[i],i,Y[i]); add(x,y); for(i=0;i<=N;i++) printf("Z[%d]=%d \n",i,Z[i]); /* verification */ z=Z[0];t=1; for(i=1;i<=N+1;i++) {t*=b;z+=(Z[i]*t);} printf("z=%ld x+y=%ld \n",z,x+y);getchar(); }/* main */ long repre(long a,long b) { long q,qq ; n=0 ; q =a/b ; A[n]=a%b ; while(q>0) {n++ ; qq=q ; q=qq/b ; A[n]=qq%b;} } /* b - representation */ long add(long x,long y) { int ii,c=0,tem; /* c is the carry digit */ for(ii=0;ii<=n;ii++) { tem=(X[ii]+Y[ii]+c); if(tem<b) {Z[ii]=tem;c=0;} else {Z[ii]=tem-b;c=1;} }/* ii */ Z[N+1]=c; }/* add */ Bài 5 Nhân hai số theo cơ số B # include<stdio.h> # include<math.h>
- Dokumentenname
- Bài tập môn An toàn Bảo mật thông tin - Thực hành phần mật mã
- Inhaltsverzeichnis
- Dieses Dokument hat kein eindeutiges Inhaltsverzeichnis.
- Seiten
- 73 Seiten
- Hochgeladen von
- ThiNganHang
Eine detaillierte Zusammenfassung wird generiert. Bitte schauen Sie in ein paar Minuten noch einmal vorbei.
Kommentare (0)
Noch keine Kommentare. Seien Sie der Erste!
Ngân hàng đề thi môn: Hệ thống thông tin quản lý
Đề thi môn Cơ sở dữ liệu (kèm Đáp án) - Đại học Sư phạm kỹ thuật
Đề thi và đáp án môn Hệ thống thông tin kế toán
Đề thi và đáp án môn Cấu trúc dữ liệu giải thuật
Đáp án đề thi môn Mạng máy tính - ĐH Công nghệ thông tin (CNTT)
Tiểu luận - Kinh tế phát triển - Phân tích nhận định "Việt Nam đã kiên định chọn hướng phát triển lấy con người làm trọng tâm ..."
Đề cương - Luật vận tải
600 Câu trắc nghiệm Tư tưởng Hồ Chí Minh
Tài liệu ôn tập Nguyên lý kế toán
Bài tập Xác suất thống kê đại học - có lời giải

Kommentare (0)
Noch keine Kommentare. Seien Sie der Erste!