Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed What's New in Python 3.6?!
You have completed What's New in Python 3.6?!
Preview
Last, but not least, Python has a new module `secrets`. This module has handy tools for generating cryptographically strong random numbers and tokens.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
other security related data.
0:00
Let me show you quickly how to use
some of these new features, and
0:00
I'm gonna start by importing secrets.
0:03
The first useful thing in the secrets
module, is the ability to generate
0:05
cryptographically strong,
random numbers and tokens.
0:08
You would use these numbers and
tokens for generating encrypted messages,
0:11
passwords, and even further tokens.
0:14
Now, why not use the random module?
0:17
Well, random is meant for modeling in
every day usage like in games, not for
0:19
security implementations.
0:23
To get a random number though,
from the secrets module,
0:25
you'll generally use one of two functions,
randbelow and randbits.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up