summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-03-14 21:01:48 -0700
committerJustin Santa Barbara <justin@fathomdb.com>2011-03-14 21:01:48 -0700
commit3d0cde272e3227978c5875c811c93e1e3df692ed (patch)
tree6163bac77a352ea360fc48207021705e7c0ca058
parentda605eb84f7d5de741225ff936447db01690a04f (diff)
downloadnova-3d0cde272e3227978c5875c811c93e1e3df692ed.tar.gz
nova-3d0cde272e3227978c5875c811c93e1e3df692ed.tar.xz
nova-3d0cde272e3227978c5875c811c93e1e3df692ed.zip
Clarify the logic in using 32 symbols
-rw-r--r--nova/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 9c8b27d56..0510c3cbe 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -267,9 +267,10 @@ def generate_password(length=20):
Believed to be reasonably secure (with a reasonable password length!)
"""
- # 26 letters, 10 digits = 36
- # Remove O, 0, I, 1 => 32 digits
- # 32 digits means we're just using the low 5 bit of each byte
+ # 26 letters, 10 digits = 36 choices
+ # Remove O, 0, I, 1 => 32 choices
+ # 32 choices means we're just using the low 5 bit of each byte,
+ # so there's no bias introduced by using a modulo
chrs = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"
random_bytes = os.urandom(length)