Encryption and hashing
導入済み
12:11
暗号化の仕組み
ブラウザのアドレスバーにあるパッドロックを見てみてください。銀行名を入力すると、なぜかノートパソコンは実際に銀行と通信していることを確信します—そして…
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| secret key | A value kept private and used to encrypt or decrypt data. |
| symmetric/sɪˈmetrɪk/ | 対称 |
| Encryption/enˈkrɪpʃn/ | The process of using a key to turn readable data into unreadable data. |
| codebooks | Books containing codes or keys used to protect secret messages. |
| shared secret/ʃeəd ˈsiːkrɪt/ | Confidential information known to authorised parties and used for a purpose such as authentication or encryption. |
| public channel | A way of sending information that other people can listen to. |
| RSA | An encryption method that uses a public key and a matching private key. |
| private key/ˈpraɪvət kiː/ | 秘密鍵 |
| asymmetric/ˌeɪsɪˈmetrɪk/ | 非対称 |
| one-way function | A process that is easy to perform but very hard to reverse. |
| hashing/ˈhæʃɪŋ/ | The process of calculating an initial record address from a key. |
| plaintext/ˈpleɪntekst/ | 平文 |
| ciphertext/ˈsaɪfətekst/ | 暗号文 |
| decrypt/dɪˈkrɪpt/ | 復号化 |
| confidentiality/ˌkɒnfɪˌdenʃiˈæləti/ | Keeping information private so only authorised people can read it. |
| algorithm/ˈælɡərɪθəm/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| AES/ˌeɪ iː ˈes/ | A fast encryption method that uses the same key to encrypt and decrypt data. |
| key distribution/kiː ˌdɪstrɪˈbjuːʃn/ | Securely providing or establishing the cryptographic keys that communicating parties need. |
| key pair/kiː peə/ | 鍵ペア |
| public key/ˈpʌblɪk kiː/ | 公開鍵 |
| key exchange | The process of sharing or agreeing a key for secure communication. |
| client/ˈklaɪənt/ | A device or program that requests a service or resource from a server. |
| session key/ˈseʃn kiː/ | セッションキー |
| server/ˈsɜːvə/ | A computer or program that provides services or resources in response to requests from clients. |
| byte/baɪt/ | A group of eight bits, commonly used as a unit of data storage. |
| HTTPS/ˌeɪtʃ tiː tiː piː ˈes/ | A secure set of rules for transferring web pages and other web content. |
| SSH | A set of rules for securely connecting to and controlling a computer from another location. |
| Diffie–Hellman key agreement | A method for two parties to agree a shared secret over a public channel. |
| cryptographic hash/ˌkrɪptəˈɡræfɪk hæʃ/ | 暗号ハッシュ |
| digest/ˈdaɪdʒest/ | ダイジェスト |
| salted password hashes | Stored values made by hashing passwords with added random data to make guessing harder. |
| database/ˈdeɪtəbeɪs/ | An organised collection of data that can be accessed and managed. |
| integrity/ɪnˈteɡrɪti/ | The accuracy, completeness and protection of data against unauthorised or unintended alteration. |
| message authentication code | A value made using a secret key to check who sent a message and whether it changed. |
| digital signature/ˈdɪdʒɪtl ˈsɪɡnɪtʃə/ | A cryptographic value created with a signing key and checked with a corresponding public key to verify data integrity and signing origin. |
公共の場で面識のない二人が秘密を合意する
- ここには不可能そうに聞こえる問題があります。あなたと店は一度も会ったことがなく、何も共有していません。互いに交わす言動は誰にも盗聴されます。秘密鍵を合意してください。
- 1976年まで、答えは「不可能だ」でした:対称暗号では、事前にキーを宅配便や対面で届ける必要があります。そのため戦時中の暗号帳は印刷されて輸送されました。
- その後ディフィー、ヘルマン、そしてリヴェスト、シャミル、アドレマンによって、それができることが示されました。それは、施錠只能用のキーと、解錠只能用の別のキーを用いることで実現できます。あなたがオンラインで行ってきたすべての購入はこの仕組みの上に成り立っています。
- このレッスンは、対称暗号と非対称暗号、なぜ現実のシステムで両方を使用するのか、そしてハッシュ関数と呼ばれる一方向関数について解説します。
語彙
- 暗号化は、キーを使って読み可能な平文を読み取れない暗号文に変換することです。復号とは、適切なキーを使ってその逆を行うことです。
- 暗号化は機密性を守ります:盗聴されたコピーでも内容を読み取ることはできません。ただし、データが盗聴されたり、遅延させられたり、削除されたりすることを防ぐものではありません。
- 強みはアルゴリズムの秘匿ではなく、キーにあります。アルゴリズムは公開されており、弱点が敵ではなく味方の研究者によって見つけられるよう、あえて研究対象となっています。
対称暗号
- 対称暗号は、暗号化にも復号にも同じキーを使います。AESが標準的な例です。
- 高速であるため、大量データに適しています:ハードディスク全体、動画ストリーム、大きなファイルなど。
- 弱点はキー配分です:キーが盗聴されることなく相手元へ届く必要がありますが、もし盗聴されればシステム全体が破綻します。$n$人の全員がペアごとに秘密通信をしたい場合、必要なキーの数は$n$の二乗に増えます。
A shift cipher (symmetric key)
Caesar's cipher shifts every letter forward by a fixed key. The SAME key both encrypts and decrypts — that is what symmetric means. Try to read the ciphertext without knowing the shift.
Symmetric encryption uses:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Symmetric encryption shares one secret key — fast, but it must be distributed securely.
非対称暗号
- 非対称暗号では、各ユーザーにキーペアが割り当てられます:世界中に公開する公開鍵と、絶対に開示しない秘密鍵です。
- 公開鍵で暗号化したものは、対応する秘密鍵でのみ復号できます。したがって、エリスに機密メッセージを送る場合は、エリスの公開鍵で暗号化し、エリスだけがそれを読むことができます。
- 事前のキー交換は不要であり、これが本レッスンで提起した問題を解決します。その代償として非常に遅いため、大量のデータには使用されません。

一方のキーで施錠し、もう一方で解錠する。そのうち一つだけが秘密である

Match each cryptographic tool to what it uses.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Symmetric is fast but needs key sharing; asymmetric solves that with a key pair; hashing is one-way; HTTPS combines them.
To send a confidential message to Alice using asymmetric encryption, you encrypt with:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Encrypting with the recipient's public key means only their matching private key can decrypt it.
Match each kind of encryption to its main weakness.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The hybrid scheme uses each to cover the other's weakness: asymmetric to deliver the key, symmetric to carry the data.
演習例:機密メッセージを送信する
- 非対称暗号がボブからエリスへの機密メッセージ送信を可能にする仕組みを説明してください。ただし、彼らは一度も会ったことがありません。 [3]
- エリスは公開鍵を公開します。これは誰でも取得でき、盗聴者を含みます。
- ボブはメッセージをエリスの公開鍵で暗号化します。この暗号文は、対応する秘密鍵でのみ復号可能です。
- エリスは自分が決して共有していない秘密鍵で復号します。公開鍵と暗号文を持っている盗聴者はメッセージを復号できません。
- 最も一般的な誤答は、「ボブは自分の鍵で暗号化する」と言うことです。各段階でどの鍵が使われているかを追跡してください。
Bob wants Alice to be sure a message really came from him. Which key does Bob use to create the digital signature?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Only Bob holds his private key, so only he can produce the signature; Alice checks it with Bob's public key. Confidentiality uses the receiver's keys, a signature uses the sender's.
ハイブリッドアプローチ、これが実際に行われていること
- 対称暗号は高速だがキーを共有できない;非対称暗号はキーを共有できるが低速です。現実のシステムでは、それぞれの特性を活かした使い分けを行います。
- クライアントはランダムなセッションキーを生成し、その小さな鍵をサーバーの公開鍵で暗号化して送信します。サーバーは自身の秘密鍵で復号し、これにより両端が同じセッションキーを保持することになります。
- その後の実際の会話の全バイトは、そのセッションキーを使って対称的に暗号化されます:高速で、遅い非対称ステップは数バイトのみに対して一度だけ行われます。
- これがHTTPSとSSHの動作原理そのものです。

キーの合意には非対称暗号、データの送信には対称暗号

In the hybrid approach used by HTTPS, asymmetric encryption is used to:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Slow asymmetric crypto just shares a session key; the bulk data then uses fast symmetric encryption.
Put the steps of this example hybrid encryption scheme in order.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
The slow asymmetric step runs once, on a few bytes; everything after it is fast symmetric encryption.
ハッシュ
- 暗号ハッシュは、任意サイズの入力を固定サイズのダイジェストに変換します。同じ入力は常に同じダイジェストを与え、入力にわずかな変化を加えるとダイジェストは完全に変わります。
- 一方向性があります:ダイジェストから入力を復元することはできません。これが目的そのものであり、復号を前提とした暗号化とは異なる点です。
- 用途:パスワードの保存(システムはダイジェストのみを保持し、ログイン時にダイジェストを比較するため、データベースが盗まれてもパスワードは漏洩しない)、および整合性の確認(ファイルのダイジェストを再計算して比較し、変更を検知する)。

A cryptographic hash produces a fixed-size ____ from an input of any size.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The same input always gives the same digest, a small change gives a completely different one, and the input cannot be recovered from it.
このカードは修正されたため、翻訳が更新されるまで英語で表示されます。
Worked example: why hash a password instead of encrypting it
- A website stores users' passwords as hashes rather than as encrypted text. Explain why.
- Encryption 加密 is reversible: a key exists somewhere that turns the stored value back into the password, and an attacker who obtains the database may also obtain the key.
- Hashing is one-way, so the stored digest cannot simply be reversed to reveal the password. However, attackers can still guess passwords and compare hashes; salted, slow password hashes make this harder.
- Login still works because the system hashes what the user typed and compares digests, never the passwords themselves.
Hashing and the avalanche effect
A hash is one-way: easy to compute, practically impossible to reverse. A tiny change in the input flips a large, unpredictable part of the output — the avalanche effect that makes hashes good for passwords.
A cryptographic hash is one-way (you cannot recover the input from the digest) and shows the avalanche effect — a tiny change in the input flips a large, unpredictable part of the output.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
One-wayness plus avalanche is what makes hashes good for storing passwords and checking integrity.
Why store passwords as hashes rather than encrypted? Select すべて that apply.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
A fixed-size digest may indeed be shorter, but that is not the security reason. Irreversibility is.
見落としやすいポイント
- 他人に機密メッセージを送る際は、相手の公開鍵を使い、自身の鍵は使いません。各段階でどの鍵を使うかを明記してください。
- 対称暗号の弱点は鍵の配布であり、非対称暗号の弱点は速度です。ハイブリッド方式はそれぞれの欠点を互いに補完するために利用します。
- ハッシュ関数は一方向性を持ち、暗号化ではありません。鍵が存在せず、復号すべき内容もありません。
- 暗号化は機密性を保護するのみです。盗聴、削除、または検知不可能な改ざんを阻止することはできません。それにはハッシュ関数が必要です。
理解できましたか
- 暗号化は平文を鍵を使って暗号文に変換し、機密性のみを保護します。強さはアルゴリズムの秘匿にあり、鍵にあります。
- 対称: 共有される1つの鍵、高速、大量データに適応、鍵の配布において弱い · 非対称: 暗号化用の公開鍵と復号用の秘密鍵、事前交換不要だが、低速
- HTTPSやSSHで使われるハイブリッド方式は、非対称暗号でランダムに生成されたセッション鍵を送信し、その後は対称暗号でデータを転送します。
- 暗号ハッシュ関数は固定長のダイジェストを作成し、一方向性を持ち、パスワード検証や完全性チェックに使用されます。
何が問題でしたか?この内容はサイトの運営チームだけが確認します。