Generating Random Numbers using secrets library in Python

Last time we discussed about Pseudo Random Generators and how they actually work under the hood. Now one might ask that how random were the keys that we generated in the previous OTP cipher code?

Well the answer is they were truly random. We have an amazing library in Python that helps in generating true random numbers. There are multiple methods available in the secrets class, which helps us to generate truly random numbers

List of functions are as below:

Choice()
Randbelow()
Randbits()
SystemRandom()
Token_bytes()
Token_hex
Token_urlsafe
Compare_digest

Comments

Popular Posts