Skip to content

Commit 12fc8d8

Browse files
max312Max Philipp Wriedt
authored and
Max Philipp Wriedt
committed
Update for 2017
Minor Code Style changes
1 parent 5e4ffbe commit 12fc8d8

File tree

7 files changed

+67
-34
lines changed

7 files changed

+67
-34
lines changed

.idea/inspectionProfiles/Project_Default.xml

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Crypt-Tools.iml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module type="PYTHON_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$" />
6-
<orderEntry type="jdk" jdkName="Python 3.3.3 (C:/SDK/Python3/python.exe)" jdkType="Python SDK" />
3+
<component name="NewModuleRootManager">
4+
<content url="file://$MODULE_DIR$">
5+
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
6+
<excludeFolder url="file://$MODULE_DIR$/.idea" />
7+
</content>
8+
<orderEntry type="jdk" jdkName="Python 3.6.0 (/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/bin/python3.6)" jdkType="Python SDK" />
79
<orderEntry type="sourceFolder" forTests="false" />
810
</component>
911
<component name="PyDocumentationSettings">
@@ -13,5 +15,4 @@
1315
<option name="projectConfiguration" value="Unittests" />
1416
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
1517
</component>
16-
</module>
17-
18+
</module>

README.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
Crypt Tools
22
=====
33

4-
This is a little collection of encryption and decryption tools
4+
This is a _little_ collection of encryption and decryption tools
55

66
Crypt Tools currently includes Caesar Cipher and Vigenère Cipher
77
More to come.
88

99
====
1010

11-
caesar.py
11+
`caesar.py`
1212
====
1313

14-
caesar.py is a simple tool to rotate the characters of a string or text
15-
caesar cipher is also known as rotate cipher
16-
.
14+
`caesar.py` is a simple tool to rotate the characters of a string or text
15+
caesar cipher is also known as rotate cipher.
1716

18-
caesar.py includes tkinter to provide a simple interface for choosing file input and output.
17+
`caesar.py` includes tkinter to provide a simple interface for choosing file input and output.
1918

2019
=====
2120

22-
vigenere.py
21+
`vigenere.py`
2322
====
2423

25-
vigenere.py is a more advanced tool than caesar.py.
24+
`vigenere.py` is a more advanced tool than caesar.py.
2625
Vigenère Cipher is using caesar cipher with rotation based on keyword.
2726

2827
Only CLI so no GUI is available at the moment.
2928
CLI intructions:
30-
- python vigenere.py -t <"TEXT"|PATHNAME> -k <KEY>
31-
- Don't forget the "" if you have a text longer than 1 word!
32-
- add "-a" to the end to analyze the frequency of characters
29+
- `python vigenere.py -t <"TEXT"|PATHNAME> -k <KEY>`
30+
- Don't forget the `""` if you have a text longer than 1 word!
31+
- add `-a` to the end to analyze the frequency of characters
3332

3433
====
3534

36-
REMINDER: None of those Ciphers is very secure as i provide de- AND encode,
35+
REMINDER: None of those Ciphers is very secure as I provide de- AND encode,
3736
don't use it for really important mails or similar!
3837

3938
====

caesar.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# coding=utf-8
2+
3+
import string
14
from tkinter.filedialog import askopenfilename
25
from tkinter.messagebox import *
3-
import string
4-
56

67
LOWER_LETTERS = string.ascii_lowercase
78
UPPER_LETTERS = string.ascii_uppercase
@@ -28,12 +29,12 @@ def encrypt(char, alpha, num):
2829

2930

3031
fileChooser = askopenfilename()
31-
inputFile = open(fileChooser, "r")
32+
inputFile = open(fileChooser)
3233
fileChooser2 = askopenfilename()
3334
outputFile = open(fileChooser2, "w")
3435

3536
string = inputFile.read()
3637
number = int(input("Number of Rotates: "))
3738
outputFile.write(rot(string, number))
3839
saveText = "Your rotated String is saved to "
39-
showinfo("Info", saveText+fileChooser2)
40+
showinfo("Info", saveText+fileChooser2)

input.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Rene 3. Wahl du stinkst!
1+
Rene 3. Wahl du riechst!

vigenere.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import sys
1+
# coding=utf-8
2+
3+
24
import string
5+
import sys
36

47
points = string.punctuation
58
numbers = string.digits
@@ -22,22 +25,23 @@ def encode(char, key):
2225
return swap['to'][res]
2326

2427

25-
## DEFINING
28+
# DEFINING
2629
setup('a', 26)
2730
setup("A", 26, 26)
2831
keyin = 0
32+
text = ""
2933
ctext = ""
30-
## INPUT
34+
# INPUT
3135
if sys.argv[1] == "-t":
3236
if ".txt" in sys.argv[2]:
33-
daten = open(sys.argv[2], "r")
37+
daten = open(sys.argv[2])
3438
text = daten.read()
3539
else:
3640
text = sys.argv[2]
3741
if sys.argv[3] == "-k":
3842
keytext = sys.argv[4]
3943

40-
## MAIN
44+
# MAIN
4145
for c in text:
4246
if c == " ":
4347
ctext += c
@@ -59,7 +63,7 @@ def encode(char, key):
5963
print(num)
6064

6165
daten = open("output.txt", 'w')
62-
daten.write(ctext);
66+
daten.write(ctext)
6367
daten = open("output.txt")
6468
print("Geheimtext: ", daten.read())
6569
print(ctext.count("?"))

0 commit comments

Comments
 (0)