Suppression de fichiers inutiles
This commit is contained in:
parent
4e514471f1
commit
a62fe5a16a
2 changed files with 0 additions and 33 deletions
|
@ -1,7 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Sauvegarder" />
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -1,26 +0,0 @@
|
|||
import string
|
||||
from random import choice
|
||||
from Crypto.Cipher import AES
|
||||
|
||||
EOD = '`%EofD%`' # This should be something that will not occur in strings
|
||||
|
||||
|
||||
def genstring(length=16, chars=string.printable):
|
||||
return ''.join([choice(chars) for i in range(length)])
|
||||
|
||||
|
||||
def encrypt(key, s):
|
||||
obj = AES.new(key)
|
||||
datalength = len(s) + len(EOD)
|
||||
if datalength < 16:
|
||||
saltlength = 16 - datalength
|
||||
else:
|
||||
saltlength = 16 - datalength % 16
|
||||
ss = ''.join([s, EOD, genstring(saltlength)])
|
||||
return obj.encrypt(ss)
|
||||
|
||||
|
||||
def decrypt(key, s):
|
||||
obj = AES.new(key)
|
||||
ss = obj.decrypt(s)
|
||||
return ss.split(EOD)[0]
|
Loading…
Reference in a new issue