-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcryptoyou.py
58 lines (41 loc) · 1.24 KB
/
cryptoyou.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from flask import Flask, request, jsonify
import crypt_functions
import decrypt_functions
app = Flask(__name__)
model = {
'cryptography' : '',
'data' : '',
'key' : ''
}
@app.route("/", methods=['GET'])
def rules():
return jsonify({
'how_to_use' : 'https://github.com/Igor-Felipy/CrypToYou ',
'cryptography_types' : {
'chinese' : 'convert the characters to chinese characters'
}
})
@app.route("/crypt", methods=['POST'])
def choose_crypt():
try:
data = request.get_json()
crypt = data['cryptography']
user_data = data['data']
key = data['key']
response = crypt_functions
return jsonify({'crypted' : response.To_crypt(user_data, crypt, key)}), 200
except:
return jsonify({'error':'server error'}), 400
@app.route("/decrypt", methods=['POST'])
def decrypt():
try:
data = request.get_json()
crypt = data['cryptography']
user_data = data['data']
key = data['key']
response = decrypt_functions
return jsonify({'decrypted':response.To_decrypt(user_data, crypt, key)}), 200
except:
return jsonify({'error':'server error'}), 400
if __name__ == "__main__":
app.run(debug=True)