Added more docstrings for libraries
This commit is contained in:
parent
58ff6a1d74
commit
799cfe2125
4 changed files with 140 additions and 15 deletions
|
|
@ -5,15 +5,38 @@ from os import urandom
|
|||
# Functions for create random strings usando urandom
|
||||
|
||||
def create_key_encrypt(n=10):
|
||||
""" Simple function for create a random string
|
||||
|
||||
Simple function for create a random string based in sha512
|
||||
|
||||
Args:
|
||||
n (int): size of string random bytes (view urandom function in Python3 Help)
|
||||
"""
|
||||
|
||||
return sha512(urandom(n)).hexdigest()
|
||||
|
||||
def create_key_encrypt_256(n=10):
|
||||
|
||||
""" Simple function for create a random string
|
||||
|
||||
Simple function for create a random string based in sha256
|
||||
|
||||
Args:
|
||||
n (int): size of string random bytes (view urandom function in Python3 Help)
|
||||
"""
|
||||
|
||||
return sha256(urandom(n)).hexdigest()
|
||||
|
||||
def create_key(n=10):
|
||||
|
||||
""" Simple function for create a random string
|
||||
|
||||
Simple function for create a random string based in urandom function and base64 encoding
|
||||
|
||||
Args:
|
||||
n (int): size of string random bytes (view urandom function in Python3 Help)
|
||||
"""
|
||||
|
||||
rand_bytes=urandom(n)
|
||||
|
||||
return b64encode(rand_bytes).decode('utf-8')[0:-2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue