本文へスキップ

リソース · ガイド・記事

Caesar Cipher Algorithm

各文字をアルファベット上で一定数ずらすシーザー暗号を手短に説明しています。文字をずらす文字列問題の準備運動になります。

確認日

元のサイトを開く: Caesar Cipher Algorithm (元のサイトを新しいタブで開きます)

ロードマップに追加

取り組んでいるロードマップにこのリソースを追加できます。自分用の追加リソースとして表示され、ロードマップの手順は変わらず、記録した手順数にも数えられません。

出典コンテンツの言語:英語

In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence. The transformation can be represented by aligning two alphabets; the cipher alphabet is the plain alphabet rotated left or right by some number of positions. For instance, here is a Caesar cipher using a left rotation of three places, equivalent to a right shift of 23 (the shift parameter is used as the key): When encrypting, a person looks up each letter of the message in the "plain" line and writes down the corresponding letter in the "cipher" line.

PrepKit の概要

この概要は PrepKit 編集部がソースリポジトリをもとに執筆・確認したもので、リソース本文の引用ではありません。

対象
ソースにレベルの記載はありません
形式
リファレンス

扱っている内容

  • 左に3つ回転させた場合の平文と暗号文のアルファベット対応表。これは右に23ずらすのと同じ
  • パングラムTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOGを暗号化する実例
  • 時間計算量と空間計算量はいずれもO(|n|)と記載

使い方

PrepKit の学習アドバイスであり、ソースの主張ではありません。

負の値を含め、任意のシフト量を受け取る暗号化関数と復号関数を書いてください。READMEの暗号文を復号して元の文が戻ることを確認します。

範囲と制約

ごく簡潔です。復号の手順説明も暗号の解読方法もなく、参考資料はWikipediaへのリンク一つだけです。

利用方法と形式

MITライセンスのtrekhleb/javascript-algorithmsリポジトリ内のGitHub上のREADMEで、英語で無料で読めます。

PrepKit が 2026/10/02 に確認しました。 リソースの出典のコミット: 85293e3e2b88

この概要の根拠
  • src/algorithms/cryptography/caesar-cipher/README.md

この項目を掲載しているページ

PrepKit ニュースレターを受け取る

任意です。PrepKit の利用には必要ありません。

メールアドレスの取り扱いについて