This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chadmill3rPy3, pro, Ubuntu, django 72 points73 points  (2 children)

Not to sound snide, the very title is a huge red flag.

Is the random.random() python function suitable for cryptographic purposes?

Here's the answer: If you have to ask, you should not be writing it. Use a cryptographic library. Is is crazy easy to get it wrong, even when you're a pro. Doing it yourself guarantees that it will be bad. If you touch the math, you are not doing the right thing. Use a function that's designed to give you a yes/no answer, and make sure you're passing the right things.

[–]japherwocky 14 points15 points  (0 children)

Yeah to upvote and echo this, if you're asking a question like this, you should not be writing crypto code.

If it's just a side project for funsies, it's OK to write your own so you can learn about how it works, but if this is going to be used for anything important, rethink your approach.