This is a program that generates a random hex value.
# How this works: # uses random to get a random number # checks what hash method to use # uses that method to hash the random number # returns the value import hashlib import random as rand def hexrandom(minint, maxint, shamode="sha1"): x = str(rand.randint(int(minint), int(maxint))) reval = None if shamode == "sha1": reval = hashlib.sha1(x.encode()).hexdigest() elif shamode == "sha224": reval = hashlib.sha224(x.encode()).hexdigest() elif shamode == "sha256": reval = hashlib.sha256(x.encode()).hexdigest() elif shamode == "sha384": reval = hashlib.sha384(x.encode()).hexdigest() elif shamode == "sha512": reval = hashlib.sha512(x.encode()).hexdigest() return reval
How it works is simple.
It creates a random number.
It then hashes that number.
And then returns that.
By the way, I tried being descriptive with explaining it, but it kept saying that there was unformated code. Sorry about that. The big description will be in a
.md file on the repository. MarkDown file here
Development of the module this will be here.