第一章習題

page 11

1.1. 在第2節中，我們若用 TUNGHAI 為加密鑰匙，那麼 SEND MONEY 的密文為何？

\(\(key1 = {"A" -> "T", "B" -> "U", "C" -> "N", "D" -> "G", "E" -> "H", "F" -> "A", "G" -> "I", "H" -> "B", "I" -> "C", "J" -> "D", "K" -> "E", "L" -> "F", "M" -> "J", "N" -> "K", "O" -> "L", "P" -> "M", "Q" -> "O", "R" -> "P", "S" -> "Q", "T" -> "R", "U" -> "S", "V" -> "V", "W" -> "W", "X" -> "X", "Y" -> "Y", "Z" -> "Z"};\)\)
encrypt1[plaintext_] := StringReplace[plaintext, key1];

encrypt1["SEND MONEY"]

1.2. 試利用連續平方法來完成第4節中未了之事

n = 23*47; 
    c = {443, 221, 35, 1047, 513, 226};
PowerMod[c, 169, n]

1.3. 試利用輾轉相除法來解下列同餘方程式：3x\equiv 1 mod{506}

PowerMod[3, -1, 506]