herrDeng網內搜尋

自訂搜尋

Ads

2009年11月30日 星期一

RSA解密練習

RSA公鑰加密的密文=
98C1784DE15551912E330595ED783158720573C75AF649E3E6A9B99BFCE9B90668CEB787D48FE7D2004B6D3F815BDA711D74F9A99748D328F1CBFA52883E63CF

請用RSA私鑰解密!

2009年11月23日 星期一

解3DES2的密文

73CEA21176D2A8FF6D863BEB24D1BEABADE024133BF5CD6A83C7209A668E3320

Key=0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02

Mode=ECB

2009年11月19日 星期四

請完成該程式!

請完成該程式!
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>

using namespace std;
struct students{
       double scores[50];
       double average;
       double stdev;
       double Me, Q1, Q3;    
};
void sort(double scores[], int len);

double computeAverage(struct students X);
......

data structure

http://spreadsheets.google.com/ccc?key=0AmrQEWnVRVj6dExxNW9oSmRlVlJjWG9Nb0ppTTdiM3c&hl=zh_TW

2009年11月12日 星期四

C加強作業


  1.  類似費氏數列 f[0]=1, f[1]=2, f[n]=2*f[n-1]+f[n-2],求f[5]=?
  2.  gcd(52,39)=?
  3.  無窮迴圈

2009年10月8日 星期四

2009年10月1日 星期四

費式數列

費式數列:

f[0]=f[1]=1
f[n]=f[n-1]+f[n-2]

請用迴圈算到n最大還是正確的f[n]值!

為什麼不要用遞迴做?

2009年6月9日 星期二

fopen

修改下列C程式,將你上學期的各科成績出到excel檔!

#include <stdio.h>
#include <stdlib.h>
int main()
{
    char s[8][30]={
         "CS0160資訊安全實習,丙",
         "CS0160資訊安全實習,甲",
         "GE0105A勞作教育,丙",
         "IM0007程式設計,丙",
         "IM0068統計學[二],甲",
         "IM0164資訊安全實習,丙",
         "OHA001導師,丙",
         "OHTA003在校輔導時間,乙"
         };
    FILE* fp=fopen("score.xls","w");
    for (int i=0; i<8; i++)
        fprintf(fp,"%d\t%s\n",i,s[i]);
    fclose(fp);
    system("Pause");
    return 0;
}

2009年5月26日 星期二

C字串練習

C字串練習

字串 char word[]="You win!";
輸出為:
You win!
You win
You wi
You w
You
You
Yo
Y

給進階使用者: gets() 是個危險的函式!

2009年5月5日 星期二

費式數列

請用 for, array算出費式數列

其中
f[0]=f[1]=1, f[n]=f[n-1]+f[n-2]

或公式解

 f(n)=1/sqrt(5)((1+sqrt(5))/2)^(n+1)-1/sqrt(5)((1-sqrt(5))/2)^(n+1)

2009年5月4日 星期一

豬流感訊息

豬流感訊息

http://www.cdc.gov.tw/mp.asp?mp=1

新型流感(H1N1)之相關訊息請查閱連結網址,內容包括
(一)H1N1(豬流感)Q&A
(二)戴口罩Q&A
(三)自我簡易監測表
(四)由流行地區返國自我健康狀況監測表
(五)呼吸道衛生與咳嗽禮節(海報版)
(六)傳染病防治調查表

◎宣導內容源自疾病管制局(http://www.cdc.gov.tw/)
◎疫情通報及諮詢專線:1922

2009年4月27日 星期一

RSA的可回復式數位簽章

以下RSA的數位簽章,是採Recover Sign的方式,
已存在"A RSA private key object"的金鑰簽署,機制為RSA_PKCS

BA270F891273A717366EEBDC02A362B4A5EFAB0DB37E4A0E6
29DA548F59385DC2523FFE52D63D6C6374525F0DFBB26BDFA
BB15ED04A85EE90AE503D2A6890F66

請還原簽署文件。

2009年4月13日 星期一

RSA解密

下列RSA密文

4C80D8A0105C1549B79340488B9BA9A215F755FC3F523DF17BD3CDEE5E9FA5
4C43D2A073A20EA22F2C169DD2F17818395D2D01D616CAA932392CC43499CD
259C

請解密

Mechanism=RSA PKCS

private Key存在"A RSA private key object"金鑰物件

程式設計練習題

1 使用C/C++程式中迴圈(for, while 或者do/while)計算算式,並含完整程式碼, 流程圖!

S = 1 × 2 × 3 + 2 × 3 × 4 + · · · + 100 × 101 × 102


2 請問下列程式片段之輸出!要加上什麼才能成為完整程式碼?
int x=5,y=3,z,w;
x-=2;
cout<<++x<<endl;
z=y++;
cout<<z<<endl;
cout<<y<<endl;
w=--z;
cout<<z<<endl;
cout<<(w<<3)<<endl;
for(x=10;x>=6;x--){
    if (x%2==1)
       continue;
    cout<<x<<endl;
    if (x==7) break;
};
cout<<x<<endl;


3 下列程式片段之輸出!並補上標頭檔

int main(){
    int j=2;
    int i=0xc;
   double E=2.7182818284590;
   printf("[%-5d]\n",i);
   printf("[%3x]\n",i);
   printf("[%3d]\n",j);
   printf("[%d]\n",sizeof(E));
   printf("[%-16.10f]\n",E);
   printf("[%f]\n",E);
   system("PAUSE");
   return 0;
}


4 下列程式片段之輸出!並用if-else改寫!流程圖為何?

int i;
for (i=0;i<7;i++)
{
   switch(i){
      case 0:
      printf("i=%d\n",i);break;
      case 1:
      printf("i=%d\n",i);break;
      case 2:
      printf("i=%d\n",i);break;
      default:
      printf("i>2\n");break;
   };
};
printf("i=%d\n", ++i);


5 下列C/C++程式之輸出!並
改寫主程式使其輸出為:
@@@@@
   @@@
      @
#include <iostream>
using namespace std;
void prCh(char ch, int rows);
int main(){
   for(int i=1;i<5;i++){
      prCh('A',i-1);
      prCh('B',i);
      cout<<endl;
   }
   cin.get();
   return 0;
}
void prCh(char ch, int rows){
   for (int i=rows;i>=1;i--){
      cout<<ch;
   }
}


6 已知20以下的質數,也知道測試400以下是否為質數的函數,請寫出C/C++程式列出
所有20<=x<=400 AND x%4==1的質數
int Prime[]={2,3,5,7,11,13,17,19,23};
bool isPrimebelow400(int n)
{
   int n_sqrt=(int)sqrt(n);
   for (int i=0; Prime[i]<=n_sqrt; i++)
   {
      if (n%Prime[i]==0 && n>Prime[i])
         return 0;
   }
   return 1;
}

2009年4月8日 星期三

3DES2 解密



3DES2 解密
Key="5D07291A 0B73E5EA 2FBCDA92 4FC4346D"
ECB 模式

密文="7841073D35BDD698AE49B150267AFA28"
明文=?

2009年4月7日 星期二

字串陣列


#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    char s[8][30]={
         "CS0160資訊安全實習,丙",
         "CS0160資訊安全實習,甲",
         "GE0105A勞作教育,丙",
         "IM0007程式設計,丙",
         "IM0068統計學[二],甲",
         "IM0164資訊安全實習,丙",
         "OHA001導師,丙",
         "OHTA003在校輔導時間,乙"
         };
    for (int i=0; i<8; i++)
        cout<<i<<"\t"<<s[i]<<endl;
    system("Pause");
    return 0;
}

計算你上學期加權平均

計算你上學期加權平均

2009年4月6日 星期一

3DES2 加密

3DES2 加密
Key1="34 13 F1 DF 57 9B BC 45"
Key2="34 13 F1 DF 57 9B BC 45"
ECB 模式
明文="56-bit DES-key is short?"
密文=?

2009年3月24日 星期二

C 的continue & break

C 的continue & break


[影片]介紹C++程式for迴圈中加上continue與break的差異之簡例



Java迴圈中的的continue & break

用 while loop

用 while loop 算

s=3*3+4*4+....88*88

2009年3月10日 星期二

作業4:複利計算

借錢500萬,年利18%,每月複利計算,請問連本帶利的金額
5, 10, 15, 20, 25, 30, 35, 40, 45, 50年的金額。並比較公式:

A*exp(0.18n)

A*(1+0.18/12)^(12*n), n=年數, A=本金

hint: math.h, pow, exp

2009年3月4日 星期三

DSA?

何謂DSA? DSS?
DSS用何種 Hash?

12 Random Number Integers from [1, 120]





<script type="text/javascript">
function rand(){
  var max=120;
  var min=1;
  for(var i=1;i<=12;i++){
    n = Math.floor(Math.random() * (max - min + 1)) + min;
    document.write(n + "<br />");
  }
}
</script>
<form>
<input type=button value="按鈕字串" onclick="rand( )">
</form>

2009年2月25日 星期三

2009年2月24日 星期二

2009年2月11日 星期三

Related Posts Plugin for WordPress, Blogger...

熱門文章