看板 Programming 關於我們 聯絡資訊
最近要學一點程式,要用提供的數學式 寫成程式碼 有點不知道要怎麼寫 也不知道要去哪個版發問 所以在這裡詢問,請見諒 Let p = 7, q = 11, then n = 77. For simplicity, let l = 2, that is, each plaintext message is split into 2 smaller pieces. Let ri = si = 5, i = 1, 2. Suppose there are two plaintext numbers in Z77: a = 10 and b = 7. It can easily be seen that 7a+b ≡ 0 (mod 77) and 14a + 2b ≡ 0 (mod 77). The scheme runs as follows. Encrypting a: Decompose a into a1 = 4 and a2 = 6. E(a) = ((4 × 5 mod 7, 4 × 5 mod 11), (6 × 5 mod 7, 6 × 5 mod 11)) = ((6, 9), (2, 8)) Encrypting b: Decompose b into b1 = 3 and b2 = 4. E(b) = ((3 × 5 mod 7, 3 × 5 mod 11), (4 × 5 mod 7, 4 × 5 mod 11)) = ((8, 4), (6, 9)) Computing E(7a + b): E(7a + b) = ((7 × 6 + 8, 7 × 9 + 4), (7 × 2 + 6, 7 × 8 + 9)) mod 77 = ((50, 67), (20, 65)) 寫成C 或 javascript都可以 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 175.180.67.19
icecastleo:作業嗎 還是自己寫吧... 1.161.38.26 12/25 21:11
Favonia:建議找原始論文看 140.112.30.39 12/25 22:08
Favonia:這是 infocom 2004 的論文。重要的數學式 140.112.30.39 12/25 22:09
Favonia:好像沒有貼出來... 140.112.30.39 12/25 22:10
MOONRAKER:既然正要學 何不就把握機會學一學218.160.178.211 12/25 22:42
freeman0220:也不算作業,只是我好無頭緒 175.180.67.19 12/25 23:36
freeman0220:不知道要怎麼寫 175.180.67.19 12/25 23:36
xatier:要不要去查查 'bc' command ? XD 140.113.27.40 12/28 12:48
MOONRAKER:這密碼學作業,bc沒效啦。 59.120.49.163 12/28 16:26