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ã
- ページ数
- 73
- 形式
- サイズ
- 2.1 MB
- 言語
- VI · Tiếng Việt
- 閲覧数
- 3,402
- コメント
- 0
- Lượt tải
- 2
プレビューを生成中...
- ドキュメント名
- 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ã
- 目次
- このドキュメントに明確な目次はありません。
- ページ数
- 73 ページ
- アップロード者
- ThiNganHang
詳細な要約を生成中です。数分後にもう一度確認してください。
説明
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>
よくある質問
このドキュメントをダウンロードするにはどうすればよいですか?
ドキュメント「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ã」の価格は 35,000đ です。PayOSでウォレットにチャージし、「ダウンロード」をクリックして元のファイルを購入・保存してください。
このドキュメントは何ページありますか?
このドキュメントは 73 ページあります。ダウンロードする前にオンラインでプレビューできます。
ダウンロードする前にプレビューできますか?
はい。このページにあるオンラインリーダーでドキュメントをプレビューし(最初の数ページ)、その後ダウンロードするかどうかを決めることができます。
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ã
プレビューを生成中...
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>
- ドキュメント名
- 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ã
- 目次
- このドキュメントに明確な目次はありません。
- ページ数
- 73 ページ
- アップロード者
- ThiNganHang
詳細な要約を生成中です。数分後にもう一度確認してください。
コメント (0)
まだコメントはありません。最初のコメントを書きましょう!
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

コメント (0)
まだコメントはありません。最初のコメントを書きましょう!