1

I want to create unique string ids that will be used in a user management system. I want each user to have a string that allows them to access their own database on a server. I read here that you can use the secrets module to create random strings, but since I don't know anything about user management I'm not sure whether to trust the pseudo-random numbers that lie behind the secrets package.

Question: Is it safe to generate a string for each user like this

secrets.token_hex(nbytes = 50)
Out[8]: '24d72775ae86151c600b6a64cef7191e2a55271615894a0ad3b05671978add68a16ad2beb66fa87e66ccdcc442ef4e57e9a4'

and let them use that string to identify themselves to enter the database on my server? Is there a better way that is as quick?

3
  • By "hash" you just mean a random string? Hashing is something very specific, and you don't seem to be doing any of it here. Commented Oct 12, 2018 at 8:18
  • @deceze Thanks, I edited my question! Commented Oct 12, 2018 at 8:21
  • 1
    This question might be better suited for Security Stack Exchange. Commented Oct 12, 2018 at 9:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.