Move Caeser, add Flask setup with Caeser-cipher.
This commit is contained in:
parent
0513ea2283
commit
1e70473250
|
@ -46,7 +46,7 @@ def encrypt(ciphertext, shiftNum, letters): # Grab parameters
|
||||||
|
|
||||||
letterCount = letterCount + 1 # Keep track of how many times we're doing this.
|
letterCount = letterCount + 1 # Keep track of how many times we're doing this.
|
||||||
|
|
||||||
print("\nYour enciphered text is: " + answer)
|
return print("\nYour enciphered text is: " + answer)
|
||||||
|
|
||||||
|
|
||||||
def decrypt(ciphertext, shiftNum, letters): # Grab parameters
|
def decrypt(ciphertext, shiftNum, letters): # Grab parameters
|
||||||
|
@ -77,7 +77,7 @@ def decrypt(ciphertext, shiftNum, letters): # Grab parameters
|
||||||
|
|
||||||
letterCount = letterCount + 1 # Keep track of how many times we're doing this.
|
letterCount = letterCount + 1 # Keep track of how many times we're doing this.
|
||||||
|
|
||||||
print("\nYour decrypted text is: " + answer)
|
return print("\nYour decrypted text is: " + answer)
|
||||||
|
|
||||||
|
|
||||||
def freq(ciphertext):
|
def freq(ciphertext):
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!flask/bin/python
|
||||||
|
from flask import Flask, request, render_template
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def my_form():
|
||||||
|
return render_template('my-form.html')
|
||||||
|
|
||||||
|
@app.route('/', methods=['POST'])
|
||||||
|
def form_post():
|
||||||
|
text = request.form['secret']
|
||||||
|
command = "python3 Caeser-Cipher/Caeser-Cipher.py encrypt " + str(text) + " 3"
|
||||||
|
ciphered_text = subprocess.check_output(command, shell=True)
|
||||||
|
return ciphered_text
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug=True)
|
|
@ -0,0 +1,12 @@
|
||||||
|
</br>
|
||||||
|
<p>Enter your message in this box.</p>
|
||||||
|
<form method="POST">
|
||||||
|
<input name="secret" type="text">
|
||||||
|
<input name="secret" type="submit" value="Encrypt rot3">
|
||||||
|
</form>
|
||||||
|
<!--</br>
|
||||||
|
<p>And your shift in this box. Then hit "shift" when you are ready.</p>
|
||||||
|
<form method="POST">
|
||||||
|
<input name="shift">
|
||||||
|
<input type="submit" value="Shift">
|
||||||
|
</form>-->
|
Loading…
Reference in New Issue