RSA算法 :首先, 找出三個(gè)數(shù), p, q, r, 其中 p, q 是兩個(gè)相異的質(zhì)數(shù), r 是與 (p-1)(q-1) 互質(zhì)的數(shù)...... p, q, r 這三個(gè)數(shù)便是 person_key,接著, 找出 m, 使得 r^m == 1 mod (p-1)(q-1)..... 這個(gè) m 一定存在, 因?yàn)?r 與 (p-1)(q-1) 互質(zhì), 用輾轉(zhuǎn)相除法就可以得到了..... 再來, 計(jì)算 n = pq....... m, n 這兩個(gè)數(shù)便是 public_key ,編碼過程是, 若資料為 a, 將其看成是一個(gè)大整數(shù), 假設(shè) a < n.... 如果 a >= n 的話, 就將 a 表成 s 進(jìn)位 (s
prolog 找路例子程序:
=== === === === === ===
Part 1-Adding connections
Part 2-Simple Path
example
| ?- path1(a,b,P,T).
will produce the response:
T = 15
P = [a,b] ?
Part 3 - Non-repeating path
As an example, the query:
?- path2(a,h,P,T).
will succeed and may produce the bindings:
P = [a,depot,b,d,e,f,h]
T = 155
Part 4 - Generating a path below a cost threshold
As an example, the query:
?- path_below_cost(a,[a,b,c,d,e,f,g,h],RS,300).
returns:
RS = [a,b,depot,c,d,e,g,f,h] ?
RS = [a,c,depot,b,d,e,g,f,h] ?
no
==================================
5 ledblink -- 跑馬燈程序
該項(xiàng)目在SDT2.51下編譯調(diào)試。最簡單的demo程序,運(yùn)行后3個(gè)發(fā)光二極管輪流點(diǎn)亮。
6 timerint -- 定時(shí)器中斷demo程序
該項(xiàng)目在SDT2.51下編譯調(diào)試。將子目錄timerint拷貝到c:\ 下。
該demo程序的主程序是while空循環(huán),定時(shí)器中斷服務(wù)程序每500ms將3個(gè)LED反相。
在57600超級(jí)終端里也可以看到中斷發(fā)生時(shí)的信息。
7 uart -- 串口測試程序
該項(xiàng)目在SDT2.51下編譯調(diào)試。運(yùn)行后在57600的超級(jí)終端里等待PC鍵盤的輸入,當(dāng)按下 a 或 b 或 c 按鍵時(shí),超級(jí)終端里將顯示 You Pressed a ,You Pressed b ,You Pressed c .