浏览代码

Initial commit.

Maria Hansen 5 年前
当前提交
99553d9a02
共有 37 个文件被更改,包括 4028 次插入0 次删除
  1. 243
    0
      .gitignore
  2. 6
    0
      crypto_challenges/03_one_time_pad_1/challenge/challenge.adoc
  3. 4
    0
      crypto_challenges/03_one_time_pad_1/challenge/ciphertext.txt
  4. 1
    0
      crypto_challenges/03_one_time_pad_1/challenge/plaintext.txt
  5. 7
    0
      crypto_challenges/04_one_time_pad_2/challenge/challenge.adoc
  6. 6
    0
      crypto_challenges/04_one_time_pad_2/challenge/ciphertext.txt
  7. 1
    0
      crypto_challenges/04_one_time_pad_2/challenge/plaintext.txt
  8. 11
    0
      crypto_challenges/05_one_time_pad_3/challenge/challenge.adoc
  9. 12
    0
      crypto_challenges/05_one_time_pad_3/challenge/ciphertext.txt
  10. 20
    0
      crypto_challenges/Caesar/challenge/challenge.adoc
  11. 二进制
      crypto_challenges/Caesar/challenge/challenge.pdf
  12. 13
    0
      crypto_challenges/Caesar/challenge/ciphertext.txt
  13. 26
    0
      crypto_challenges/Caesar/challenge/english_freq.txt
  14. 70
    0
      crypto_challenges/Frequency_Analyzer/challenge/freqanalyzer.adoc
  15. 2701
    0
      crypto_challenges/Frequency_Analyzer/challenge/freqanalyzer.pdf
  16. 21
    0
      crypto_challenges/Frequency_Analyzer/test.txt
  17. 17
    0
      crypto_challenges/Monoalphabetic_Substitution/challenge/challenge.adoc
  18. 二进制
      crypto_challenges/Monoalphabetic_Substitution/challenge/challenge.pdf
  19. 1
    0
      crypto_challenges/Monoalphabetic_Substitution/challenge/ciphertext.txt
  20. 26
    0
      crypto_challenges/Monoalphabetic_Substitution/challenge/english_freq.txt
  21. 64
    0
      crypto_challenges/Monoalphabetic_Substitution/challenge/monoalphabetic_substitution.html
  22. 100
    0
      crypto_challenges/Vigenere/challenge/challenge.adoc
  23. 二进制
      crypto_challenges/Vigenere/challenge/challenge.pdf
  24. 2
    0
      crypto_challenges/Vigenere/challenge/ciphertext.txt
  25. 676
    0
      crypto_challenges/Vigenere/challenge/english_bigram.txt
  26. 二进制
      slides_pdf/loesungen_slides_crypto_03_modern_cryptography_stream_ciphers.pdf
  27. 二进制
      slides_pdf/loesungen_slides_crypto_03_modern_cryptography_stream_ciphers_bw.pdf
  28. 二进制
      slides_pdf/slides_crypto_00_course_intro.pdf
  29. 二进制
      slides_pdf/slides_crypto_00_course_intro_bw.pdf
  30. 二进制
      slides_pdf/slides_crypto_01_intro.pdf
  31. 二进制
      slides_pdf/slides_crypto_01_intro_bw.pdf
  32. 二进制
      slides_pdf/slides_crypto_02_modular_arithmetic.pdf
  33. 二进制
      slides_pdf/slides_crypto_02_modular_arithmetic_bw.pdf
  34. 二进制
      slides_pdf/slides_crypto_03_historic_ciphers.pdf
  35. 二进制
      slides_pdf/slides_crypto_03_historic_ciphers_bw.pdf
  36. 二进制
      slides_pdf/slides_crypto_04_modern_cryptography_stream_ciphers.pdf
  37. 二进制
      slides_pdf/slides_crypto_04_modern_cryptography_stream_ciphers_bw.pdf

+ 243
- 0
.gitignore 查看文件

@@ -0,0 +1,243 @@
1
+# Created by .ignore support plugin (hsz.mobi)
2
+### JetBrains template
3
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
4
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
5
+
6
+# User-specific stuff
7
+.idea/**/workspace.xml
8
+.idea/**/tasks.xml
9
+.idea/**/usage.statistics.xml
10
+.idea/**/dictionaries
11
+.idea/**/shelf
12
+
13
+# Generated files
14
+.idea/**/contentModel.xml
15
+
16
+# Sensitive or high-churn files
17
+.idea/**/dataSources/
18
+.idea/**/dataSources.ids
19
+.idea/**/dataSources.local.xml
20
+.idea/**/sqlDataSources.xml
21
+.idea/**/dynamic.xml
22
+.idea/**/uiDesigner.xml
23
+.idea/**/dbnavigator.xml
24
+
25
+# Gradle
26
+.idea/**/gradle.xml
27
+.idea/**/libraries
28
+
29
+# Gradle and Maven with auto-import
30
+# When using Gradle or Maven with auto-import, you should exclude module files,
31
+# since they will be recreated, and may cause churn.  Uncomment if using
32
+# auto-import.
33
+# .idea/artifacts
34
+# .idea/compiler.xml
35
+# .idea/jarRepositories.xml
36
+# .idea/modules.xml
37
+# .idea/*.iml
38
+# .idea/modules
39
+# *.iml
40
+# *.ipr
41
+
42
+# CMake
43
+cmake-build-*/
44
+
45
+# Mongo Explorer plugin
46
+.idea/**/mongoSettings.xml
47
+
48
+# File-based project format
49
+*.iws
50
+
51
+# IntelliJ
52
+out/
53
+
54
+# mpeltonen/sbt-idea plugin
55
+.idea_modules/
56
+
57
+# JIRA plugin
58
+atlassian-ide-plugin.xml
59
+
60
+# Cursive Clojure plugin
61
+.idea/replstate.xml
62
+
63
+# Crashlytics plugin (for Android Studio and IntelliJ)
64
+com_crashlytics_export_strings.xml
65
+crashlytics.properties
66
+crashlytics-build.properties
67
+fabric.properties
68
+
69
+# Editor-based Rest Client
70
+.idea/httpRequests
71
+
72
+# Android studio 3.1+ serialized cache file
73
+.idea/caches/build_file_checksums.ser
74
+
75
+### JupyterNotebooks template
76
+# gitignore template for Jupyter Notebooks
77
+# website: http://jupyter.org/
78
+
79
+.ipynb_checkpoints
80
+*/.ipynb_checkpoints/*
81
+
82
+# IPython
83
+profile_default/
84
+ipython_config.py
85
+
86
+# Remove previous ipynb_checkpoints
87
+#   git rm -r .ipynb_checkpoints/
88
+
89
+### VirtualEnv template
90
+# Virtualenv
91
+# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
92
+.Python
93
+[Bb]in
94
+[Ii]nclude
95
+[Ll]ib
96
+[Ll]ib64
97
+[Ll]ocal
98
+[Ss]cripts
99
+pyvenv.cfg
100
+.venv
101
+pip-selfcheck.json
102
+
103
+### Python template
104
+# Byte-compiled / optimized / DLL files
105
+__pycache__/
106
+*.py[cod]
107
+*$py.class
108
+
109
+# C extensions
110
+*.so
111
+
112
+# Distribution / packaging
113
+.Python
114
+build/
115
+develop-eggs/
116
+dist/
117
+downloads/
118
+eggs/
119
+.eggs/
120
+lib/
121
+lib64/
122
+parts/
123
+sdist/
124
+var/
125
+wheels/
126
+pip-wheel-metadata/
127
+share/python-wheels/
128
+*.egg-info/
129
+.installed.cfg
130
+*.egg
131
+MANIFEST
132
+
133
+# PyInstaller
134
+#  Usually these files are written by a python script from a template
135
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
136
+*.manifest
137
+*.spec
138
+
139
+# Installer logs
140
+pip-log.txt
141
+pip-delete-this-directory.txt
142
+
143
+# Unit test / coverage reports
144
+htmlcov/
145
+.tox/
146
+.nox/
147
+.coverage
148
+.coverage.*
149
+.cache
150
+nosetests.xml
151
+coverage.xml
152
+*.cover
153
+*.py,cover
154
+.hypothesis/
155
+.pytest_cache/
156
+cover/
157
+
158
+# Translations
159
+*.mo
160
+*.pot
161
+
162
+# Django stuff:
163
+*.log
164
+local_settings.py
165
+db.sqlite3
166
+db.sqlite3-journal
167
+
168
+# Flask stuff:
169
+instance/
170
+.webassets-cache
171
+
172
+# Scrapy stuff:
173
+.scrapy
174
+
175
+# Sphinx documentation
176
+docs/_build/
177
+
178
+# PyBuilder
179
+.pybuilder/
180
+target/
181
+
182
+# Jupyter Notebook
183
+.ipynb_checkpoints
184
+
185
+# IPython
186
+profile_default/
187
+ipython_config.py
188
+
189
+# pyenv
190
+#   For a library or package, you might want to ignore these files since the code is
191
+#   intended to run in multiple environments; otherwise, check them in:
192
+# .python-version
193
+
194
+# pipenv
195
+#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
196
+#   However, in case of collaboration, if having platform-specific dependencies or dependencies
197
+#   having no cross-platform support, pipenv may install dependencies that don't work, or not
198
+#   install all needed dependencies.
199
+#Pipfile.lock
200
+
201
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow
202
+__pypackages__/
203
+
204
+# Celery stuff
205
+celerybeat-schedule
206
+celerybeat.pid
207
+
208
+# SageMath parsed files
209
+*.sage.py
210
+
211
+# Environments
212
+.env
213
+.venv
214
+env/
215
+venv/
216
+ENV/
217
+env.bak/
218
+venv.bak/
219
+
220
+# Spyder project settings
221
+.spyderproject
222
+.spyproject
223
+
224
+# Rope project settings
225
+.ropeproject
226
+
227
+# mkdocs documentation
228
+/site
229
+
230
+# mypy
231
+.mypy_cache/
232
+.dmypy.json
233
+dmypy.json
234
+
235
+# Pyre type checker
236
+.pyre/
237
+
238
+# pytype static type analyzer
239
+.pytype/
240
+
241
+# Cython debug symbols
242
+cython_debug/
243
+

+ 6
- 0
crypto_challenges/03_one_time_pad_1/challenge/challenge.adoc 查看文件

@@ -0,0 +1,6 @@
1
+= One Time Pad (easy)
2
+
3
+Task
4
+----
5
+
6
+In link:./ciphertext.txt[this file] a bunch of messages are encrypted with the same key. the link:./plaintext.txt[plain text] of the first message is known. find the key and decrypt the other messages.

+ 4
- 0
crypto_challenges/03_one_time_pad_1/challenge/ciphertext.txt 查看文件

@@ -0,0 +1,4 @@
1
+76b614f657cf718fe41fa6a5b91144eb
2
+76b675824cc077c4b017bfe0fd0052e1
3
+76b6758223c67788a811f2f2b2025fe1
4
+17961deb47ca778ae413b7f6ae1154e0

+ 1
- 0
crypto_challenges/03_one_time_pad_1/challenge/plaintext.txt 查看文件

@@ -0,0 +1 @@
1
+attack at dawn

+ 7
- 0
crypto_challenges/04_one_time_pad_2/challenge/challenge.adoc 查看文件

@@ -0,0 +1,7 @@
1
+= One Time Pad (2)
2
+
3
+Task
4
+----
5
+
6
+In link:./ciphertext.txt[this file] the messages are encrypted with the same key. The link:./plaintext.txt[plain text] of *one* of the messages is known. 
7
+Find the key and decrypt the other messages.

+ 6
- 0
crypto_challenges/04_one_time_pad_2/challenge/ciphertext.txt 查看文件

@@ -0,0 +1,6 @@
1
+58062ac82943788d172b4804710091792820ad91f0c2aee79d33726f666f3b0f1ed9ed64ef9d18db54ed0791410377d5566f29a7e9c8bef66424b869d073751c7ec0a2a4973cea88c14f8becd98c79ed5fa5c7352a115c5a525fe131fd58973242424f877d2681d3ddb973fd097a9d8e5895e9ee4924387711517be37ca06abb7c85a4b40e07388619817149057842e514d5fe5d49c51e6dbafbcb6795f91352de76673b1d78834ff6f52e220e04e0009197d4f82be65f4b1904c055f2de7c643d6e196c45f3b340a26fc812e95ac9f25a
2
+58062ac82943788d172b4804710091792820add89ee2cd95e4430600011d5a7f76a0cd1087f838b43a8873f82c6657a5370b09e8bd989e9f1704d907f0161b7f0cb9d2d0fe5384a8b52ae884b7e508983a85b35d4b657c3933318f5e8978f55762213de61e4de4b7fddb06892908f8b643dcefe353776c6b111266fe70f170b87c85a4ab0c0325810081294d57741cb60cd5e54a4881557faaafd72f91f91252dd7728255471830ce5e37a6d1741f54f9e9cc2e52be0524c1256c658f3de656e6e7c0b2b41f3be4bae75c65fff1fd7e71e
3
+58062ac82943788d172b4804710091792820add89ee2cd95e4430600011d5a7f76a0cd1087f838b43a8873f82c6657a5370b09e8bd989e9f1704d907f042731a6299b7b19d3ba4cadc5ec8ebc5c56bf05bf7d23e3f000e195c57af2ae11dd5270e4054886a289cc3ddb275a94c669b8d548cefee5e242e66541261fd7be96bb43283a4b214423b86008c714d1f784ff513c6fe5d5e951a66a7b2d168d0bb0947937c3568176a871df6e57a280e04ea1d909d91fe63f7175a16409448e4977f666e70176f55bfb057eb60cb56f34bcee914
4
+58062ac82943788d172b4804710091792820add8d784ede18c26266b64647a160580b962f294419448e91d9c430b77c4432b658ddcebeabf7677f96b9f787c5f6dcaf2a49636a4d8d94b81eac38070ec1aebd62b2e175c4b5644fc3bed589c39425655897228c4d88ffb6fe70978998d59dcfae55e24277a04052ef376ed75b13990e1b719423f8a1796344d576907f31294f85048c5076db0aed37b99b70713d07a37201170920aeff22e3a1548e04f9d9591e366e25859044dd651f2de656e6e791d6852aaa151eb6edd12f84dc2e711
5
+58062ac82943788d172b4804710091792820add89ee2cd95e4430600011d5a7f76a0cd1087f838b43a8873f82c6657a5370b09e8bd989e9f1704d907f0161b7f0cb9d2d0b727a4c0d459c8e5db9667b858e0d6336b150e564554e17efd1094234240539f3e2e8dc795be74a95e618c970d88f3ee1a743e7004147ce460a06abb7c94e1a906072f9b5497345a05780cef5cd9f94b59c5007ba6fbd46a89aa4044da672f681164800af4f2673b1948f54f8b98d4aa78f35a4f5756d14ce29763642378167f53f3b056eb4efb62ba54c2ff09
6
+1c6f4da15d2214ad614e3a77186fff0a084fcbf8f18ca8e18d2e6320717c3e5f15c9bd78e28a4b9452e9059d0c0432c0592b7c9bd8fcbefd6e24b766847f74117f99b4bf8c73e7dadc5e81e7d68928fc53f5df32260408505011ee30ed58983e0e4849876c34c4d492b66bfc47619b9e5995f4e51a66396b540566f539f077b23e88e1b6134223895497345a026f0ab617d1f518498c067cb1b2dd7a84b00f5d937b263e11228b0ef3e32e391441e14f969dc1f86af143431445d81df191632123720b7f00b2a155a768cc53ee56c8e809

+ 1
- 0
crypto_challenges/04_one_time_pad_2/challenge/plaintext.txt 查看文件

@@ -0,0 +1 @@
1
+It has also been proven that any cipher with the property of perfect secrecy must use keys with effectively the same requirements as OTP keys

+ 11
- 0
crypto_challenges/05_one_time_pad_3/challenge/challenge.adoc 查看文件

@@ -0,0 +1,11 @@
1
+= One Time Pad (hard)
2
+
3
+Task
4
+----
5
+
6
+In link:./ciphertext.txt[this file] all messages are encrypted with the same key. But this time, you do not have a plaintext available
7
+to solve the task easily.
8
+Yet, your task is to obtain the key and decrypt the *last messages* in the text!
9
+
10
+TIP: Observe what happens when you `XOR` one specific characters with some other characters.
11
+

+ 12
- 0
crypto_challenges/05_one_time_pad_3/challenge/ciphertext.txt 查看文件

@@ -0,0 +1,12 @@
1
+425c37edec19399dcfb4e78d0759c8bda4b1b8c5ac119d4bef0afcaa69580c3e900eccda45297677a8a3d4ae8b74de322e304d329422b3195cbf35b45798fac5b523561907e455f63312c0a018c59ea7d6706c786a880eb9d8c397d00bbd2df2a01919be829f49c9102dc3c6f00a01641afb41f83489f636cee006c041136e40c0bf1be545a56eef2740e7
2
+544a37cbf81b7c898ea0fc97191d9ca5b3feb4d1a31f8119aa55a3e567110c3ed10b99d5442a2372e1b39bb79364c525392e4370a624fc1758a235b41b88fa97bd27474d1be21aec3e578fa84dcb8ebbd424326d67df26a3de8c988902bd3fa1f40416f7a98f418c16659084e5100f2b1cf65e
3
+356d7febad197098cbf7e78a1c17dbf5a0f3b9c5b553b35caa42a5e56f1111259011d6cc0b2a663aebb2c2b38f6ecd253d330b77b134b3195cbf35b14982e380f323150107e255ed3d5786af03cb85e2c7312f3e6ad24789d18dd6b200bc2fba
4
+415172aeee1e6993cba5e7870d0d9ca5b3feb2c5a2169c19ad42e9eb3e461d37db5fdcd5482f7a6afca9d4addb60c63033310a66ab2ab31652be7ea61b8ae6c5b42d5a0948f706a2381e90a608da88a7dc247d3d389003b8d38692d00dab6ab3f4180ca583944ac9012c80d6e8081e2d01fd13fc3dceed2dcaf11d8d4c1e1c7fcab305f815cd55f42648fb37cbfb115e
5
+4c5662aee91877dbdaf7e4831b0d9cf5b5fef6d2b40ad858ef48acfe3e5e1e76d31ecb9b40387a69a8a6c9ac9621cb773b361a32b42ffc5a4ea170b6528af98ca927464d01f855f12f1281a204c69be2c7312f3e6ad24780d19195d03dbd3eb7ba091da58bda4e86092f86cae51104234efc5dbd12c5eb2fd3e007
6
+415172fce8577889cbf7e7951a59c8acb1f4a590ae15d85abd42b9fe71560a37c017c09b067d7772e9b49bb49368c93f7c340a7eaf67f81f58a135a65e88e780a731151e09f010a23d058fa34dd193b7d67031243e8b0ba890909f831bb738fef40a16b3cc8e4588106294ccf81b026419fa5ff171c2e73ad3a506850f41595bd1fa1af003882ffb394af365dff50a429875bcf49ed8ad52bed05c575935e1a6d565c2f43392576031330889
7
+415172aef90076dbdaaee3875516daf5a2e8a6c4ae148a58bf53b0b03e5e1633900bd1da5f7d6276e4afccb0db75c2327c040c64a635fd1758bf61f54f84b590a027150f1ae301e77b118fbc0ecddcb6cb703f3f2f9e0cedc48b93d00cbd2eb7f84b19b988da4287016297ccf00c4a360be246f423ccf17fd7ed10c02b5c4a4ad0b404f40b992fe92405eb36c3ba1d42cd66b6a29dc5b15cbe9e5c185477d1b1c16d87ad0f84052e2c2215
8
+425c37edec193988cbb2b3961d1c9ca5aef8b8c4e104905cbd5ee9fe76545835d816c99b422e236fe6a8dab38b788a3e3a630232b435fc145af177bc4fcbfc96f33150031cb614ec3f5783a103db89afc1237d20258d02edc08c81951df22ca0bb0658a3849f0d8c0a348ad6fe16072100e713b071e8e63683d61d81015a4e
9
+54193ffeff1e6f9adab2b389100095f5a4ffb5c2b8038c50a055e9f97d591d3bd55fcacf4a296669a8f39ba29766c52535370b7fb06bb3145cbc70b942cbf4c5a3305a0e0df200f03e5786a11f889ba7ca352f2c3e9609aa908893891cfe6ab3f41b0ab88f9f499c1627c3c2fe0a4a2100f041e421ddeb31c4a9558102571c4e82aa1bfe06886be83940be23c9e85f54dd71a1fb8bdeaa51bc9017
10
+415172aece187798c7a4f6c23a01dabab3f592d9a2079156a15abbf33e194a668049909b4f386573e6a5c8e39873d327282c4373b067e71258f174a74fcbfa83f362421f01e21cec3c578fee1f888fadc82634232ddf04a2d48685de4f
11
+54557baee419399ac2bbb3961d1cceb0e1f8a590b21e9955a31bbde2775f1f76c41099c84a242d3ac9e0ddaa976dcf257c20027ce32ff6164df161ba1b98fa89a527151900f355f0321384a208889de2c639296d289a13b9d591d68407b324f2a3020cbf838f5981
12
+415172aefe127a89cba3b38f100acfb4a6f4f6d9b249d86ea75ea7aa6b421138d75fd89b5829717fe9ad9ba09271c2322e6f437ca631f6081da466b01b9ffd80f329501448fb1af03e5794a60cc6dcadca3338

+ 20
- 0
crypto_challenges/Caesar/challenge/challenge.adoc 查看文件

@@ -0,0 +1,20 @@
1
+= Caesar cipher
2
+:imagesdir: images
3
+:icons: font
4
+:source-highlighter: rouge
5
+:stem: latexmath
6
+
7
+== Task
8
+
9
+The messages in link:./ciphertext.txt[this file] are encrypted with the caesar cipher, all messages are seperated with newline. Each line uses a different letter for the caesar-shifting.
10
+Your task is to decrypt all messages. Of course, this can simply be done by brute forcing each line and manually select the assumed semantic correct sentence. However, your task is trying to do the selection of the correct messages automatically.
11
+
12
+[TIP]
13
+====
14
+The file link:./english_freq.txt[letter frequencies list] contains the statistical standard distribution of letters for the english language. _The first line corresponds to `A`, the last line corresponds to `Z`._ 
15
+Enhance your Frequency Analyzer and write a function that determines to what extend a given plaintext aligns with the standard distribution for the language. This can be done by using the so called *_chi square_* test: +
16
+
17
+stem:[\displaystyle \sum_{i=0}^{k=25}{\frac{(observed_i - expected_i)^2}{expected_i}}] +
18
+
19
+In each case, select the plaintext with the lowest score from the _chi square_ test.
20
+====

二进制
crypto_challenges/Caesar/challenge/challenge.pdf 查看文件


+ 13
- 0
crypto_challenges/Caesar/challenge/ciphertext.txt 查看文件

@@ -0,0 +1,13 @@
1
+Vgjglzq danwv af lzw eavkl gx lzw yjwsl Csfksk hjsajawk, oalz Mfudw Zwfjq, ozg osk s xsjewj, sfv Smfl We, ozg osk lzw xsjewj'k oaxw. Lzwaj zgmkw osk kesdd, xgj lzw dmetwj lg tmadv al zsv lg tw usjjawv tq osygf esfq eadwk. Lzwjw owjw xgmj osddk, s xdggj sfv s jggx, ozauz esvw gfw jgge; sfv lzak jgge ugflsafwv s jmklq dggcafy uggcklgnw, s umhtgsjv xgj lzw vakzwk, s lstdw, lzjww gj xgmj uzsajk, sfv lzw twvk. Mfudw Zwfjq sfv Smfl We zsv s tay twv af gfw ugjfwj, sfv Vgjglzq s dalldw twv af sfglzwj ugjfwj. Lzwjw osk fg ysjjwl sl sdd, sfv fg uwddsj--wpuwhl s kesdd zgdw vmy af lzw yjgmfv, usddwv s uqudgfw uwddsj, ozwjw lzw xseadq ugmdv yg af uskw gfw gx lzgkw yjwsl ozajdoafvk sjgkw, eayzlq wfgmyz lg ujmkz sfq tmadvafy af alk hslz. Al osk jwsuzwv tq s ljsh vggj af lzw eavvdw gx lzw xdggj, xjge ozauz s dsvvwj dwv vgof aflg lzw kesdd, vsjc zgdw.
2
+Nyve Ufifkyp jkffu ze kyv uffinrp reu cffbvu rifleu, jyv tflcu jvv efkyzex slk kyv xivrk xirp girzizv fe vmvip jzuv. Efk r kivv efi r yfljv sifbv kyv sifru jnvvg fw wcrk tflekip kyrk ivrtyvu kf kyv vuxv fw kyv jbp ze rcc uzivtkzfej. Kyv jle yru srbvu kyv gcfnvu creu zekf r xirp drjj, nzky czkkcv tirtbj ileezex kyiflxy zk. Vmve kyv xirjj nrj efk xivve, wfi kyv jle yru slievu kyv kfgj fw kyv cfex scruvj lekzc kyvp nviv kyv jrdv xirp tfcfi kf sv jvve vmvipnyviv. Fetv kyv yfljv yru svve grzekvu, slk kyv jle sczjkvivu kyv grzek reu kyv irzej nrjyvu zk rnrp, reu efn kyv yfljv nrj rj ulcc reu xirp rj vmvipkyzex vcjv.
3
+Lwtc Pjci Tb rpbt iwtgt id axkt hwt lph p ndjcv, egtiin lxut. Iwt hjc pcs lxcs wps rwpcvts wtg, idd. Iwtn wps ipztc iwt hepgzat ugdb wtg tnth pcs atui iwtb p hdqtg vgpn; iwtn wps ipztc iwt gts ugdb wtg rwttzh pcs axeh, pcs iwtn ltgt vgpn pahd. Hwt lph iwxc pcs vpjci, pcs ctktg hbxats cdl. Lwtc Sdgdiwn, lwd lph pc dgewpc, uxghi rpbt id wtg, Pjci Tb wps qttc hd hipgiats qn iwt rwxas'h apjvwitg iwpi hwt ldjas hrgtpb pcs egthh wtg wpcs jedc wtg wtpgi lwtctktg Sdgdiwn'h btggn kdxrt gtprwts wtg tpgh; pcs hwt hixaa addzts pi iwt axiiat vxga lxiw ldcstg iwpi hwt rdjas uxcs pcniwxcv id apjvw pi.
4
+Letcv Yveip evmvi crlxyvu. Yv nfibvu yriu wifd dfiezex kzcc ezxyk reu uzu efk befn nyrk afp nrj. Yv nrj xirp rcjf, wifd yzj cfex svriu kf yzj iflxy sffkj, reu yv cffbvu jkvie reu jfcvde, reu irivcp jgfbv.
5
+Sd gkc Dydy drkd wkno Nybydri vkeqr, kxn ckfon rob pbyw qbygsxq kc qbki kc rob ydrob cebbyexnsxqc. Dydy gkc xyd qbki; ro gkc k vsddvo lvkmu nyq, gsdr vyxq csvui rksb kxn cwkvv lvkmu oioc drkd dgsxuvon wobbsvi yx osdrob csno yp rsc pexxi, goo xyco. Dydy zvkion kvv nki vyxq, kxn Nybydri zvkion gsdr rsw, kxn vyfon rsw nokbvi.
6
+Wrgdb, krzhyhu, wkhb zhuh qrw sodblqj. Xqfoh Khqub vdw xsrq wkh grruvwhs dqg orrnhg dqalrxvob dw wkh vnb, zklfk zdv hyhq judbhu wkdq xvxdo. Grurwkb vwrrg lq wkh grru zlwk Wrwr lq khu dupv, dqg orrnhg dw wkh vnb wrr. Dxqw Hp zdv zdvklqj wkh glvkhv. Iurp wkh idu qruwk wkhb khdug d orz zdlo ri wkh zlqg, dqg Xqfoh Khqub dqg Grurwkb frxog vhh zkhuh wkh orqj judvv erzhg lq zdyhv ehiruh wkh frplqj vwrup. Wkhuh qrz fdph d vkdus zklvwolqj lq wkh dlu iurp wkh vrxwk, dqg dv wkhb wxuqhg wkhlu hbhv wkdw zdb wkhb vdz ulssohv lq wkh judvv frplqj iurp wkdw gluhfwlrq dovr.
7
+Dfoopywj Fynwp Spycj dezzo fa. "Espcp'd l njnwzyp nzxtyr, Px," sp nlwwpo ez std htqp. "T'ww rz wzzv lqepc esp deznv." Espy sp cly ezhlco esp dspod hspcp esp nzhd lyo szcdpd hpcp vpae. Lfye Px oczaapo spc hzcv lyo nlxp ez esp ozzc. Zyp rwlynp ezwo spc zq esp olyrpc nwzdp le slyo. "Bftnv, Ozczesj!" dsp dncplxpo. "Cfy qzc esp npwwlc!"
8
+Ytyt ozruji tzy tk Itwtymd'x fwrx fsi mni zsijw ymj gji, fsi ymj lnwq xyfwyji yt ljy mnr. Fzsy Jr, gfiqd kwnlmyjsji, ymwjb tujs ymj ywfu ittw ns ymj kqttw fsi hqnrgji itbs ymj qfiijw nsyt ymj xrfqq, ifwp mtqj. Itwtymd hfzlmy Ytyt fy qfxy fsi xyfwyji yt ktqqtb mjw fzsy. Bmjs xmj bfx mfqkbfd fhwtxx ymj wttr ymjwj hfrj f lwjfy xmwnjp kwtr ymj bnsi, fsi ymj mtzxj xmttp xt mfwi ymfy xmj qtxy mjw kttynsl fsi xfy itbs xziijsqd zuts ymj kqttw.
9
+Maxg t lmktgzx mabgz atiixgxw. Max ahnlx pabkexw tkhngw mph hk makxx mbfxl tgw khlx lehper makhnza max tbk. Whkhmar yxem tl by lax pxkx zhbgz ni bg t uteehhg. Max ghkma tgw lhnma pbgwl fxm paxkx max ahnlx lmhhw, tgw ftwx bm max xqtvm vxgmxk hy max vrvehgx. Bg max fbwwex hy t vrvehgx max tbk bl zxgxkteer lmbee, unm max zkxtm ikxllnkx hy max pbgw hg xoxkr lbwx hy max ahnlx ktblxw bm ni abzaxk tgw abzaxk, ngmbe bm ptl tm max oxkr mhi hy max vrvehgx; tgw maxkx bm kxftbgxw tgw ptl vtkkbxw fbexl tgw fbexl tptr tl xtlber tl rhn vhnew vtkkr t yxtmaxk.
10
+Uf ime hqdk pmdw, mzp ftq iuzp taixqp taddunxk mdagzp tqd, ngf Padaftk ragzp etq ime dupuzs cgufq qmeuxk. Mrfqd ftq rudef rqi itudxe mdagzp, mzp azq aftqd fuyq itqz ftq tageq fubbqp nmpxk, etq rqxf me ur etq iqdq nquzs daowqp sqzfxk, xuwq m nmnk uz m odmpxq.
11
+Ojoj ydy ijo gdfz do. Cz mvi vwjpo ocz mjjh, ijr czmz, ijr oczmz, wvmfdib gjpygt; wpo Yjmjoct nvo lpdoz nodgg ji ocz agjjm viy rvdozy oj nzz rcvo rjpgy cvkkzi.
12
+Utik Zuzu muz zuu tkgx znk uvkt zxgv juux, gtj lkrr ot; gtj gz loxyz znk rozzrk moxr znuamnz ynk ngj ruyz nos. Haz yuut ynk ygc utk ul noy kgxy yzoiqotm av znxuamn znk nurk, lux znk yzxutm vxkyyaxk ul znk gox cgy qkkvotm nos av yu zngz nk iuarj tuz lgrr. Ynk ixkvz zu znk nurk, igamnz Zuzu he znk kgx, gtj jxgmmkj nos otzu znk xuus gmgot, glzkxcgxj iruyotm znk zxgv juux yu zngz tu suxk giiojktzy iuarj ngvvkt.
13
+Vcif othsf vcif doggsr okom, obr gzckzm Rcfchvm uch cjsf vsf tfwuvh; pih gvs tszh eiwhs zcbszm, obr hvs kwbr gvfwsysr gc zcirzm ozz opcih vsf hvoh gvs bsofzm psqoas rsot. Oh twfgh gvs vor kcbrsfsr wt gvs kcizr ps rogvsr hc dwsqsg kvsb hvs vcigs tszz ouowb; pih og hvs vcifg doggsr obr bchvwbu hsffwpzs voddsbsr, gvs ghcddsr kcffmwbu obr fsgczjsr hc kowh qozazm obr gss kvoh hvs tihifs kcizr pfwbu. Oh zogh gvs qfokzsr cjsf hvs gkomwbu tzccf hc vsf psr, obr zom rckb idcb wh; obr Hchc tczzcksr obr zom rckb psgwrs vsf. Wb gdwhs ct hvs gkomwbu ct hvs vcigs obr hvs kowzwbu ct hvs kwbr, Rcfchvm gccb qzcgsr vsf smsg obr tszz togh ogzssd.

+ 26
- 0
crypto_challenges/Caesar/challenge/english_freq.txt 查看文件

@@ -0,0 +1,26 @@
1
+0.08167
2
+0.01492
3
+0.02202
4
+0.04253
5
+0.12702
6
+0.02228
7
+0.02015
8
+0.06094
9
+0.06966
10
+0.00153
11
+0.01292
12
+0.04025
13
+0.02406
14
+0.06749
15
+0.07507
16
+0.01929
17
+0.00095
18
+0.05987
19
+0.06327
20
+0.09356
21
+0.02758
22
+0.00978
23
+0.02560
24
+0.00150
25
+0.01994
26
+0.00077

+ 70
- 0
crypto_challenges/Frequency_Analyzer/challenge/freqanalyzer.adoc 查看文件

@@ -0,0 +1,70 @@
1
+= Frequency Analyzer
2
+
3
+== Task
4
+
5
+Implement a program that analyzes arbitrary text files by counting the occurrence of letters.
6
+All special characters (e.g. `-`, `.`, `,`,`\s`,`\n`) and numbers should be ignored.
7
+The program should treat all letters as case-insensitive and output:
8
+
9
+* the letter,
10
+* the number of it occurance and
11
+* a percentage value in relation to all letters in the text
12
+
13
+---
14
+
15
+For example, the following text should generate a similar output as shown below.
16
+
17
+`This is a simple test`
18
+
19
+[cols="",opts="autowidth"]
20
+|===
21
+|S |4 | 0.23529 | 23.529 %
22
+|T |3 | 0.17647 | 17.647 %
23
+|I |3 | 0.17647 | 17.647 %
24
+|E |2 | 0.11765 | 11.765 %
25
+|H |1 | 0.05882 | 5.882 %
26
+|A |1 | 0.05882 | 5.882 %
27
+|M |1 | 0.05882 | 5.882 %
28
+|P |1 | 0.05882 | 5.882 %
29
+|L |1 | 0.05882 | 5.882 %
30
+|===
31
+
32
+---
33
+
34
+TIP: Design your program such that you can easily reuse the frequency-analysis component in other programs as well.
35
+
36
+WARNING: You can use any programming language you want. We will need the frequency analyzer for some other challenges as well. So choose wisely!
37
+
38
+---
39
+Example output of a fequency analyzer program using the input link:./../test.txt[test.txt].
40
+
41
+[source, Shell]
42
+--
43
+$ python solution.py ../test.txt 
44
+E  562 0.11408
45
+T  467 0.09480
46
+I  428 0.08688
47
+A  423 0.08587
48
+O  396 0.08038
49
+S  356 0.07226
50
+U  344 0.06983
51
+M  299 0.06069
52
+R  292 0.05927
53
+L  277 0.05623
54
+D  246 0.04993
55
+N  242 0.04912
56
+C  137 0.02781
57
+P  104 0.02111
58
+G   77 0.01563
59
+V   67 0.01360
60
+B   52 0.01055
61
+Q   38 0.00771
62
+Y   28 0.00568
63
+K   24 0.00487
64
+F   22 0.00446
65
+J   12 0.00243
66
+H   11 0.00223
67
+Z   10 0.00203
68
+X    8 0.00162
69
+W    4 0.00081
70
+--

+ 2701
- 0
crypto_challenges/Frequency_Analyzer/challenge/freqanalyzer.pdf
文件差异内容过多而无法显示
查看文件


+ 21
- 0
crypto_challenges/Frequency_Analyzer/test.txt 查看文件

@@ -0,0 +1,21 @@
1
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.   
2
+
3
+Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.   
4
+
5
+Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.   
6
+
7
+Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.   
8
+
9
+Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.   
10
+
11
+At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.   
12
+
13
+Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.   
14
+
15
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.   
16
+
17
+Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.   
18
+
19
+Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.   
20
+
21
+Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo.

+ 17
- 0
crypto_challenges/Monoalphabetic_Substitution/challenge/challenge.adoc 查看文件

@@ -0,0 +1,17 @@
1
+= Monoalphabetic substitution cipher
2
+
3
+Task
4
+----
5
+
6
+The letters in link:./ciphertext.txt[this file] are encrypted with a monoalphabetic substitution cipher.
7
+The encrypted message consists a single line ending with a newline.
8
+Decrypt the message!
9
+
10
+How
11
+---
12
+
13
+. Write a program that sorts the letters of the encrypted message text by frequency
14
+    .. Use your developed frequency analyzer to derive the statistical distribution of the letters
15
+    .. Do not use an online tool to solve this challenge!
16
+. Use this link:./monoalphabetic_substitution.html[tool] and start substituting according to the link:./english_freq.txt[most common letters list]
17
+

二进制
crypto_challenges/Monoalphabetic_Substitution/challenge/challenge.pdf 查看文件


+ 1
- 0
crypto_challenges/Monoalphabetic_Substitution/challenge/ciphertext.txt 查看文件

@@ -0,0 +1 @@
1
+XG IRK R WYXTPG NDVE ERO XU RAYXV, RUE GPQ NVDNCK IQYQ KGYXCXUT GPXYGQQU. IXUKGDU KLXGP, PXK NPXU UHJJVQE XUGD PXK WYQRKG XU RU QSSDYG GD QKNRAQ GPQ MXVQ IXUE, KVXAAQE BHXNCVO GPYDHTP GPQ TVRKK EDDYK DS MXNGDYO LRUKXDUK, GPDHTP UDG BHXNCVO QUDHTP GD AYQMQUG R KIXYV DS TYXGGO EHKG SYDL QUGQYXUT RVDUT IXGP PXL. GPQ PRVVIRO KLQVG DS WDXVQE NRWWRTQ RUE DVE YRT LRGK. RG DUQ QUE DS XG R NDVDHYQE ADKGQY, GDD VRYTQ SDY XUEDDY EXKAVRO, PRE WQQU GRNCQE GD GPQ IRVV. XG EQAXNGQE KXLAVO RU QUDYLDHK SRNQ, LDYQ GPRU R LQGYQ IXEQ: GPQ SRNQ DS R LRU DS RWDHG SDYGO-SXMQ, IXGP R PQRMO WVRNC LDHKGRNPQ RUE YHTTQEVO PRUEKDLQ SQRGHYQK. IXUKGDU LREQ SDY GPQ KGRXYK. XG IRK UD HKQ GYOXUT GPQ VXSG. QMQU RG GPQ WQKG DS GXLQK XG IRK KQVEDL IDYCXUT, RUE RG AYQKQUG GPQ QVQNGYXN NHYYQUG IRK NHG DSS EHYXUT EROVXTPG PDHYK. XG IRK ARYG DS GPQ QNDUDLO EYXMQ XU AYQARYRGXDU SDY PRGQ IQQC. GPQ SVRG IRK KQMQU SVXTPGK HA, RUE IXUKGDU, IPD IRK GPXYGO-UXUQ RUE PRE R MRYXNDKQ HVNQY RWDMQ PXK YXTPG RUCVQ, IQUG KVDIVO, YQKGXUT KQMQYRV GXLQK DU GPQ IRO. DU QRNP VRUEXUT, DAADKXGQ GPQ VXSG-KPRSG, GPQ ADKGQY IXGP GPQ QUDYLDHK SRNQ TRJQE SYDL GPQ IRVV. XG IRK DUQ DS GPDKQ AXNGHYQK IPXNP RYQ KD NDUGYXMQE GPRG GPQ QOQK SDVVDI ODH RWDHG IPQU ODH LDMQ. WXT WYDGPQY XK IRGNPXUT ODH, GPQ NRAGXDU WQUQRGP XG YRU.

+ 26
- 0
crypto_challenges/Monoalphabetic_Substitution/challenge/english_freq.txt 查看文件

@@ -0,0 +1,26 @@
1
+E 12.359 %
2
+T  8.952 %
3
+A  8.050 %
4
+O  7.715 %
5
+N  6.958 %
6
+I  6.871 %
7
+H  6.502 %
8
+S  6.290 %
9
+R  5.746 %
10
+D  4.537 %
11
+L  4.030 %
12
+U  2.805 %
13
+M  2.591 %
14
+C  2.378 %
15
+W  2.354 %
16
+F  2.181 %
17
+Y  2.119 %
18
+G  2.042 %
19
+P  1.682 %
20
+B  1.494 %
21
+V  1.032 %
22
+K  0.853 %
23
+X  0.145 %
24
+J  0.127 %
25
+Q  0.099 %
26
+Z  0.088 %

+ 64
- 0
crypto_challenges/Monoalphabetic_Substitution/challenge/monoalphabetic_substitution.html 查看文件

@@ -0,0 +1,64 @@
1
+<html>
2
+    <head>
3
+        <style>
4
+            input {
5
+                width:30%;
6
+            }
7
+            .letter {
8
+                width:90%;
9
+                padding-left:10px;
10
+            }
11
+        </style>
12
+        <script>
13
+            function load() {
14
+                var list = document.getElementById("list");
15
+                for (var i = 1; i <= 26; i++) {
16
+                    var div = document.createElement("DIV");
17
+                    var input = document.createElement("INPUT");
18
+                    div.classList.add("letter");
19
+                    div.innerHTML = String.fromCharCode(i + 64) + " => ";
20
+                    if (input.value == "") { input.value = String.fromCharCode(i + 64); }
21
+                    input.id = "k" + i;
22
+                    input.oninput = function(){decrypt()}; 
23
+                    input.maxLength = "1";
24
+                    div.appendChild(input);
25
+                    list.appendChild(div);
26
+                }
27
+            }
28
+
29
+            function decrypt() {
30
+                var cipher = document.getElementById("cipher").value;
31
+                var key = [];
32
+                for (var i = 1; i <= 26; i++) {
33
+                    var letter = document.getElementById("k"+i).value;
34
+                    key.push(letter.toUpperCase());
35
+                }
36
+                cipher = cipher.toLowerCase()
37
+                for (var i = 1; i <= 26; i++) {
38
+                    cipher = cipher.replace(new RegExp(String.fromCharCode(i + 96), 'g'), key[i-1]);
39
+                }
40
+                document.getElementById("plain").innerHTML = cipher;
41
+            }
42
+        </script>
43
+    </head>
44
+
45
+    <body onload="load()">
46
+
47
+        
48
+        <div style="width:80%;height:10%;border:1px solid black;position:absolute;left:10%;top:5%" >
49
+            <h1 align="center" style="width:100%;height:100%;"> Monoalphabetic Substitution </h1>
50
+        </div>
51
+        <div style="width:70%;height:40%;border:1px solid black;position:absolute;left:10%;top:15%;overflow:scroll" >
52
+            <h1> Cipher Text </h1>
53
+            <textarea id="cipher" oninput="decrypt()" style="width:100%;height:100%;resize:none"> </textarea>
54
+        </div>
55
+        <div style="width:70%;height:40%;border:1px solid black;position:absolute;left:10%;top:55%;overflow:scroll" >
56
+            <h1> Plain Text </h1>
57
+            <p id="plain"> </p>
58
+        </div>
59
+        
60
+        <div id="list" style="width:10%;height:80%;border:1px solid black;position:absolute;left:80%;top:15%;overflow:scroll" >        
61
+            <h1 align="center"> Map </h1>
62
+        </div>
63
+    </body>
64
+</html>

+ 100
- 0
crypto_challenges/Vigenere/challenge/challenge.adoc 查看文件

@@ -0,0 +1,100 @@
1
+= Vigenere cipher
2
+:stem: latexmath
3
+
4
+== Task
5
+
6
+
7
+The content of link:./ciphertext.txt[this file] is encrypted with a _Vigenere cipher_. (The key length is limited to 20 letters) +
8
+
9
+Your task is to decrypt the content. Please note that you do not know the length of the key in this task!
10
+
11
+Your solution will only be accepted if you find a better approach than simply trying all possible combinations for every possible key length  (w.r.t. brute force) paired with a _simple_ frequency analysis.
12
+
13
+_A more intelligent appraoch will solve this task in roughtly quadratic time stem:[O=n^2], whereas trying all possible combinations, i.e. brute force, needs exponential time stem:[O=c^n \leftarrow c \gt 1]._
14
+
15
+
16
+== Help
17
+
18
+[NOTE]
19
+====
20
+The values used in this example are artifical and not the real values. For a very short text, the solution is not accurate enough!
21
+====
22
+
23
+. you need to guess the key length, thus you know it is not longer than 20 letters, try every possible key length stem:[2 \leq length \leq 20] 
24
+
25
+. for every key length analyze the ciphertext statistically to derive the best plaintext
26
+
27
+.. you have to crack the key two letters at a time +
28
+if the length is 3
29
+
30
+    VHEEMCRD (<- note that this is the plaintext for the example)
31
+    ABCABCAB
32
+    
33
+you observe that the letters VH, EM and RD are encrypted with the first two letters of the key
34
+
35
+.. cut the ciphertext to strings with the size of the key length. each column is then encoded with one letter +
36
+example: +
37
+Suppose the key is *ABC*. The _ciphertext_ *VIGENERE* should be cut into
38
+
39
+    VIG
40
+    ENE
41
+    RE
42
+    
43
+    
44
+. combining the first string with the second, the second with the third and so on. the last string should be combined with the first +
45
+this gives us:
46
+
47
+    01 01 01 (key_index)
48
+    --------
49
+    VI EN RE # letters enrypted with key[0] and key[1]
50
+
51
+    12 12    (key_index)
52
+    -----
53
+    IG NE    # letters enrypted with key[1] and key[2]
54
+
55
+    20 20    (key_index)
56
+    -----
57
+    GV EE    # letters enrypted with key[2] and key[0]
58
+    
59
+. for each sequence of two consecutive letters try all possible two letters keys (AA, AB, AC, ..., ZY, ZZ)
60
+
61
+    VI EN RE decrypted with AA gives VI EN RE 
62
+    VI EN RE decrypted with AB gives VH EM RD
63
+    ...
64
+    VI EN RE decrypted with ZZ gives WJ FO SF
65
+    
66
+. using the link:./english_bigram[Bigram Frequencies] (the frequencies are sorted alphabetically) give each key a score by multiplying the frequencies of the bigrams in the plaintext
67
+
68
+     CIPHER  | KEY | PLAIN
69
+    --------------------------
70
+    VI EN RE | AB  | VH EM RD
71
+    --------------------------
72
+    score(AB) = frequency(VH) + frequency(EM) + frequency(RD)
73
+
74
+[TIP]
75
+--
76
+* Normally, you would calculate the score by multiplication: `score(AB) = frequency(VH) * frequency(EM) * frequency(RD)`. However, with the given bigram frequencies, which are provided as logarithmic values, you can use an addition instead
77
+* This means, the calculation using the numbers from the provided Bigram Frequencies is as follows: `score(AB) = frequency(VH) + frequency(EM) + frequency(RD)`
78
+** The higher the calculated value, the better is the score for that particular bigram pair
79
+--
80
+
81
+. select for each string the key with the best score
82
+
83
+     PLAIN   | KEY | K_index | SCORE
84
+    -----------------------------------
85
+    VH EM RD | AB  | 01      |151125528
86
+    DA IY    | FG  | 12      |119303088
87
+    EI CR    | CN  | 20      |122328401
88
+
89
+. form the final key from these keys
90
+
91
+    key[0] is either A or N, since score(AB) > score(CN), take A
92
+    key[1] is either B or F, since score(AB) > score(FG), take B
93
+    key[2] is either G or C, since score(CN) > score(FG), take C
94
+    => the best key of length 3 is ABC
95
+
96
+. do this process for key lengths 2 to 20
97
+
98
+. using frequency analysis find the best fit of the 19 keys
99
+
100
+

二进制
crypto_challenges/Vigenere/challenge/challenge.pdf 查看文件


+ 2
- 0
crypto_challenges/Vigenere/challenge/ciphertext.txt
文件差异内容过多而无法显示
查看文件


+ 676
- 0
crypto_challenges/Vigenere/challenge/english_bigram.txt 查看文件

@@ -0,0 +1,676 @@
1
+1721143
2
+8775582
3
+17904683
4
+14877234
5
+815963
6
+5702567
7
+8809266
8
+2225270
9
+13974919
10
+870262
11
+5137311
12
+38211584
13
+15975981
14
+69775179
15
+749566
16
+8553911
17
+315068
18
+42353262
19
+37773878
20
+48274564
21
+4884168
22
+8288885
23
+3918960
24
+660826
25
+11523416
26
+768359
27
+8867461
28
+689158
29
+320380
30
+141752
31
+19468489
32
+75352
33
+40516
34
+154489
35
+4356462
36
+282608
37
+26993
38
+6941044
39
+191807
40
+106125
41
+8172395
42
+115161
43
+5513
44
+4621080
45
+1409672
46
+428276
47
+8113271
48
+120081
49
+140189
50
+3021
51
+5232074
52
+8132
53
+19930754
54
+298053
55
+3026492
56
+358435
57
+19803619
58
+267630
59
+181590
60
+20132750
61
+8446084
62
+41526
63
+7205091
64
+5683204
65
+285942
66
+188046
67
+26737101
68
+382923
69
+157546
70
+5514347
71
+1381608
72
+11888752
73
+4604045
74
+94224
75
+257253
76
+5300
77
+1145316
78
+57914
79
+17584055
80
+6106719
81
+3782481
82
+4001275
83
+27029835
84
+4033878
85
+2442139
86
+4585765
87
+21673998
88
+799366
89
+525744
90
+3050945
91
+3544905
92
+2840522
93
+13120322
94
+3145043
95
+283314
96
+5701879
97
+10429887
98
+15759673
99
+5861311
100
+1238565
101
+4906814
102
+27413
103
+2218040
104
+98038
105
+43329810
106
+9738798
107
+25775798
108
+46647960
109
+18497942
110
+13252227
111
+8286463
112
+7559141
113
+16026915
114
+1256993
115
+2411639
116
+23092248
117
+18145294
118
+48991276
119
+13524186
120
+14024377
121
+1461436
122
+77134382
123
+57070453
124
+32872552
125
+3674130
126
+10574011
127
+14776406
128
+5649363
129
+7528342
130
+465466
131
+8357929
132
+888155
133
+1570791
134
+748027
135
+8529289
136
+6085519
137
+637758
138
+1507604
139
+11993833
140
+269865
141
+228905
142
+2890839
143
+1251312
144
+534362
145
+18923772
146
+1199845
147
+47504
148
+8339376
149
+2047416
150
+13696078
151
+3138900
152
+244685
153
+1005903
154
+19313
155
+789961
156
+31186
157
+11239788
158
+1184377
159
+1299541
160
+879792
161
+14425023
162
+1465290
163
+1468286
164
+9880399
165
+7103140
166
+176947
167
+163830
168
+2576787
169
+1178511
170
+2426429
171
+8188708
172
+1215204
173
+59750
174
+6989963
175
+3920675
176
+7347990
177
+3768430
178
+186777
179
+1567991
180
+14778
181
+979804
182
+28514
183
+35971841
184
+1014004
185
+1441057
186
+828755
187
+100689263
188
+834284
189
+429607
190
+1329998
191
+27495342
192
+189906
193
+210385
194
+1169468
195
+1353001
196
+1383958
197
+19729026
198
+978649
199
+101241
200
+3843001
201
+2462026
202
+8351551
203
+2771830
204
+197539
205
+1403223
206
+7526
207
+1446451
208
+37066
209
+10002012
210
+2598444
211
+21468412
212
+12896787
213
+12505546
214
+5740414
215
+9530574
216
+610683
217
+607124
218
+219128
219
+2585124
220
+17877600
221
+10544422
222
+87674002
223
+21210160
224
+3348621
225
+291635
226
+11681353
227
+37349981
228
+37938534
229
+576683
230
+9129232
231
+922059
232
+879360
233
+98361
234
+1865802
235
+1712763
236
+19380
237
+24770
238
+21903
239
+1487348
240
+12640
241
+12023
242
+20960
243
+357577
244
+16085
245
+13967
246
+12149
247
+22338
248
+14452
249
+2721345
250
+34520
251
+722
252
+80471
253
+39326
254
+20408
255
+2924815
256
+8925
257
+16083
258
+747
259
+5723
260
+2859
261
+2833038
262
+457860
263
+420017
264
+277982
265
+10650670
266
+537342
267
+209266
268
+650095
269
+5814357
270
+76816
271
+118811
272
+846309
273
+485617
274
+1903836
275
+1758001
276
+375653
277
+13905
278
+507020
279
+3227333
280
+1443985
281
+506618
282
+73184
283
+719633
284
+5083
285
+553296
286
+11192
287
+23178317
288
+2463693
289
+2328063
290
+10245579
291
+30383262
292
+2702522
293
+926472
294
+1274048
295
+23291169
296
+218362
297
+1164186
298
+24636875
299
+2216514
300
+752316
301
+15596310
302
+2543957
303
+77148
304
+1505092
305
+8675452
306
+6817273
307
+4402940
308
+1238287
309
+1836811
310
+15467
311
+13742031
312
+57314
313
+21828378
314
+4121764
315
+1101727
316
+481126
317
+27237733
318
+715087
319
+285133
320
+710864
321
+12168944
322
+134263
323
+111041
324
+478528
325
+3730508
326
+558397
327
+12950768
328
+7835172
329
+21358
330
+660619
331
+3922855
332
+3055946
333
+3755834
334
+136314
335
+937621
336
+14250
337
+1949129
338
+18271
339
+23547524
340
+3602692
341
+15214623
342
+46194306
343
+27331675
344
+4950333
345
+38567365
346
+3915410
347
+17452104
348
+1342735
349
+3043200
350
+3692985
351
+3796928
352
+5180899
353
+18894111
354
+2968126
355
+217422
356
+2393580
357
+21306421
358
+50701084
359
+3732602
360
+2194534
361
+4215967
362
+74844
363
+4343290
364
+266461
365
+6554221
366
+6212512
367
+7646952
368
+7610214
369
+2616308
370
+30540904
371
+4163126
372
+3254659
373
+5336616
374
+661082
375
+3397570
376
+13726491
377
+21066156
378
+56915252
379
+10168856
380
+10459455
381
+122677
382
+45725191
383
+13596265
384
+20088048
385
+31112284
386
+7350014
387
+14610429
388
+650078
389
+1932892
390
+228556
391
+12068709
392
+369336
393
+400308
394
+273162
395
+15573318
396
+418168
397
+211133
398
+2825344
399
+5559210
400
+47043
401
+83017
402
+9812226
403
+931225
404
+131645
405
+11917535
406
+4873393
407
+18607
408
+13191182
409
+2377036
410
+3812475
411
+3858148
412
+48105
413
+530411
414
+6814
415
+396147
416
+9697
417
+73527
418
+27307
419
+10667
420
+8678
421
+6020
422
+8778
423
+2567
424
+12273
425
+73387
426
+1342
427
+2023
428
+9603
429
+12315
430
+3808
431
+9394
432
+6062
433
+2499
434
+5975
435
+20847
436
+16914
437
+4169424
438
+4212
439
+34669
440
+765
441
+4557
442
+280
443
+28645577
444
+3346212
445
+6974063
446
+9025637
447
+60923600
448
+3436232
449
+4645938
450
+2968706
451
+27634643
452
+518157
453
+4491400
454
+4803246
455
+7377989
456
+7064635
457
+29230770
458
+3588188
459
+156933
460
+5896212
461
+21237259
462
+21456059
463
+5330557
464
+2692445
465
+3348005
466
+38654
467
+8788539
468
+113432
469
+30080131
470
+5553684
471
+10800636
472
+3842250
473
+31532272
474
+6073995
475
+2043770
476
+16773127
477
+25758841
478
+704442
479
+2321888
480
+4965012
481
+5580755
482
+4157990
483
+23903631
484
+10570626
485
+800346
486
+3513808
487
+18915696
488
+54018399
489
+10031005
490
+882083
491
+8673234
492
+50975
493
+2214270
494
+79840
495
+26147593
496
+3815459
497
+5196817
498
+2346516
499
+42295813
500
+3368452
501
+1530045
502
+116997844
503
+42888666
504
+559473
505
+610333
506
+5403137
507
+3759861
508
+1782119
509
+46115188
510
+3070427
511
+159111
512
+15821226
513
+18922522
514
+19367472
515
+8477495
516
+698150
517
+8910254
518
+28156
519
+8008918
520
+280007
521
+4589997
522
+2990868
523
+5742385
524
+3499535
525
+4927837
526
+701892
527
+4832325
528
+339341
529
+3481482
530
+88168
531
+514873
532
+10173468
533
+4389720
534
+15237699
535
+649906
536
+5306948
537
+23386
538
+17341717
539
+15699353
540
+15137169
541
+63043
542
+212051
543
+352732
544
+144814
545
+531960
546
+153736
547
+4111375
548
+29192
549
+59024
550
+85611
551
+29320973
552
+28090
553
+25585
554
+30203
555
+9380037
556
+11432
557
+11469
558
+49032
559
+35024
560
+33082
561
+2253292
562
+62577
563
+1488
564
+96416
565
+204093
566
+62912
567
+82830
568
+22329
569
+45608
570
+3192
571
+233082
572
+2633
573
+16838794
574
+394820
575
+448394
576
+432646
577
+13185116
578
+336213
579
+139890
580
+11852909
581
+15213018
582
+99435
583
+148964
584
+657782
585
+505687
586
+3649615
587
+9106647
588
+321746
589
+16245
590
+1226755
591
+1988727
592
+1301293
593
+180884
594
+63930
595
+674610
596
+4678
597
+553647
598
+52836
599
+904148
600
+94041
601
+697995
602
+60101
603
+653947
604
+113031
605
+39289
606
+166599
607
+1024736
608
+10629
609
+13651
610
+59585
611
+127492
612
+34734
613
+211173
614
+1840696
615
+5416
616
+90046
617
+154347
618
+1509969
619
+147533
620
+31117
621
+119322
622
+35052
623
+94329
624
+2082
625
+7239548
626
+2696786
627
+3128053
628
+2122337
629
+6499305
630
+2305244
631
+1049082
632
+2291273
633
+4461214
634
+378679
635
+391953
636
+2013939
637
+2516273
638
+1485655
639
+9088497
640
+2581863
641
+87953
642
+2021939
643
+7539621
644
+6714151
645
+695512
646
+411487
647
+3379064
648
+16945
649
+332973
650
+78281
651
+929119
652
+50652
653
+41037
654
+32906
655
+1709871
656
+28658
657
+26369
658
+107639
659
+644035
660
+7167
661
+24262
662
+80039
663
+46034
664
+24241
665
+424016
666
+30389
667
+5773
668
+32685
669
+94993
670
+56955
671
+113538
672
+14339
673
+68865
674
+2463
675
+105871
676
+221275

二进制
slides_pdf/loesungen_slides_crypto_03_modern_cryptography_stream_ciphers.pdf 查看文件


二进制
slides_pdf/loesungen_slides_crypto_03_modern_cryptography_stream_ciphers_bw.pdf 查看文件


二进制
slides_pdf/slides_crypto_00_course_intro.pdf 查看文件


二进制
slides_pdf/slides_crypto_00_course_intro_bw.pdf 查看文件


二进制
slides_pdf/slides_crypto_01_intro.pdf 查看文件


二进制
slides_pdf/slides_crypto_01_intro_bw.pdf 查看文件


二进制
slides_pdf/slides_crypto_02_modular_arithmetic.pdf 查看文件


二进制
slides_pdf/slides_crypto_02_modular_arithmetic_bw.pdf 查看文件


二进制
slides_pdf/slides_crypto_03_historic_ciphers.pdf 查看文件


二进制
slides_pdf/slides_crypto_03_historic_ciphers_bw.pdf 查看文件


二进制
slides_pdf/slides_crypto_04_modern_cryptography_stream_ciphers.pdf 查看文件


二进制
slides_pdf/slides_crypto_04_modern_cryptography_stream_ciphers_bw.pdf 查看文件