Creating a python loop where the input is a random number
Question
This is my code so far:
import bcrypt
import random
def PRG():
print(random.randint(1,100000))
For i in range(1,3):
print(bcrypt.gensalt(PRG()))
Which gives the output:
77494
$2a$04$2tpKWJxtsBAK1FYdM.6MSe
87956
$2a$04$4ag2YmOBFSFRR3Lu0RgQ8.
I'm just trying to make a loop that gives a bunch of salts based on what random number PRG() outputs. I'm not sure if the hash is the hash of the number output by PRG() because bcrypt output isn't fixed, and if someone could tell me how to remove the numeric output I'd really appreciate it.
Solution
replace print(random.randint(1,100000))
with return random.randint(1,100000)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow