Beispiel #1
0
 def sha1(cls, raw_output=False):
     """
     Calculates the sha1 hash of a given string
     :example 'b5d86317c2a144cd04d0d7c03b2b02666fafadf2'
     """
     res = hashlib.sha1(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #2
0
 def sha256(cls, raw_output=False):
     """
     Calculates the sha256 hash of a given string
     :example '85086017559ccc40638fcde2fecaf295e0de7ca51b7517b6aebeaaf75b4d4654'
     """
     res = hashlib.sha256(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #3
0
 def md5(cls, raw_output=False):
     """
     Calculates the md5 hash of a given string
     :example 'cfcd208495d565ef66e7dff9f98764da'
     """
     res = hashlib.md5(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #4
0
 def sha256(cls, raw_output=False):
     """
     Calculates the sha256 hash of a given string
     :example '85086017559ccc40638fcde2fecaf295e0de7ca51b7517b6aebeaaf75b4d4654'
     """
     res = hashlib.sha256(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #5
0
 def sha1(cls, raw_output=False):
     """
     Calculates the sha1 hash of a given string
     :example 'b5d86317c2a144cd04d0d7c03b2b02666fafadf2'
     """
     res = hashlib.sha1(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #6
0
 def md5(cls, raw_output=False):
     """
     Calculates the md5 hash of a given string
     :example 'cfcd208495d565ef66e7dff9f98764da'
     """
     res = hashlib.md5(str(random.random()).encode('utf-8'))
     if raw_output:
         return res.digest()
     return res.hexdigest()
Beispiel #7
0
 def timestamp(self):
     return fake.unix_time() + round(random.random(), 6)