Skip to content

平成21年度 秋期 ITパスポート試験 問62

This question's explanation and your answers so far.

問62
頻出度★★☆

小文字の英字からなる文字列の暗号化を考える。次表で英字を文字番号に変換し,変換後の文字番号について1文字目分には1を,2文字目分には2を,…,n文字目分にはnを加える。それぞれの数を26で割った余りを新たに文字番号とみなし,表から対応する英字に変換する。 例 fax → 6, 1, 24 → 6+1, 1+2, 24+3 → 7, 3, 27 → 7, 3, 1 → gca この手続で暗号化した結果が“tmb”であるとき,元の文字列はどれか。

文字番号12345678910111213
英字abcdefghijklm
文字番号14151617181920212223242526
英字nopqrstuvwxyz
出典 平成21年度 秋期 ITパスポート試験 問62
解説

問 62

  • Incorrectア

    Encrypting “she” gives s=19, h=8, e=5 → 19+1=20, 8+2=10, 5+3=8 → “tjh”, which is not “tmb”. The 2nd and 3rd characters do not match.

  • Incorrectイ

    Encrypting “shy” gives s=19, h=8, y=25 → 20, 10, 28→2 → “tjb”. The 1st and 3rd characters match, but the 2nd character is j, not m.

  • Incorrectウ

    Encrypting “ski” gives s=19, k=11, i=9 → 20, 13, 12 → “tml”. The 1st and 2nd characters match, but the 3rd character is l, not b. This is an easy wrong answer to pick if you make a mistake decrypting the 3rd character (b→y).

  • エ

    正解 The encryption rule is “add the position n to the character number, then take the remainder divided by 26 as the new character number”, so decryption is simply the reverse: “subtract the position n from the character number”. Converting the ciphertext “tmb” with the table gives t=20, m=13, b=2. For the 1st character, 20−1=19 → s; for the 2nd, 13−2=11 → k; for the 3rd, 2−3=−1, which is negative, so add 26 to get 25 → y. Put together, the original string is “sky”, so エ is correct. As a check, encrypting “sky” gives s=19, k=11, y=25 → 19+1=20, 11+2=13, 25+3=28 → the remainder of 28 divided by 26 is 2 → 20, 13, 2 → t, m, b, which is back to “tmb”. Also, as the example “27 → 1” shows, the key point is the wrap-around handling: when a number exceeds 26, subtract 26 (that is, take the remainder).

ここがポイント
  • In a substitution cipher of the Caesar type, if encryption is “add n, then take the remainder modulo 26”, then decryption is the inverse operation: “subtract n, and if the result is negative, add 26”.
  • In a scheme where the shift amount changes with the position (+1 for the 1st character, +2 for the 2nd, and so on), the key points are not to miscount the position of each character and to handle the wrap-around correctly (take the remainder modulo 26) when the value exceeds 26 or drops to 0 or below.
用語

Your answers