From 59083cdd3ae4e18acfbfd26bd91beb8b98f1d95a Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Mon, 14 Dec 2015 17:31:09 +0100 Subject: [PATCH] Added new function for create random hashs --- paramecio/citoplasma/keyutils.py | 6 ++++++ paramecio/modules/admin/index.py | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 paramecio/citoplasma/keyutils.py diff --git a/paramecio/citoplasma/keyutils.py b/paramecio/citoplasma/keyutils.py new file mode 100644 index 0000000..2ffe7bf --- /dev/null +++ b/paramecio/citoplasma/keyutils.py @@ -0,0 +1,6 @@ +from hashlib import sha512 +from os import urandom + +def create_key_encrypt(n=10): + + return sha512(urandom(n)).hexdigest() diff --git a/paramecio/modules/admin/index.py b/paramecio/modules/admin/index.py index 8f36bb1..518d6ca 100644 --- a/paramecio/modules/admin/index.py +++ b/paramecio/modules/admin/index.py @@ -17,16 +17,12 @@ from importlib import import_module, reload from bottle import redirect from collections import OrderedDict from time import time -from hashlib import sha512 -from os import urandom, path +from paramecio.citoplasma.keyutils import create_key_encrypt +from os import path #from citoplasma.login import LoginClass # Check login -def create_key_encrypt(): - - return sha512(urandom(10)).hexdigest() - key_encrypt=create_key_encrypt() module_admin=path.dirname(__file__)