new short expiring url for files

This commit is contained in:
2019-10-31 12:37:13 +02:00
parent 3195c87840
commit fbbef99305
6 changed files with 173 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import base64
#~ from Crypto.Cipher import AES
import hashlib
#~ class Crypto:
#~ def __init__(self, secret):
#~ self.secret = add_pad(secret[0:16])
@@ -68,6 +69,14 @@ def random_token():
return token
def random_expiring_hash():
codes = []
for i in range(3):
codes.append("".join([random.choice(string.ascii_letters + string.digits) for n in range(4)]))
ehash = "-".join(codes)
return ehash
def remove_pad(string):
""" Remove spaces from right """
return string.rstrip(" ")