don't use python's random for session IDs
authorThomasV <thomasv@gitorious>
Fri, 6 Dec 2013 16:51:33 +0000 (20:51 +0400)
committerThomasV <thomasv@gitorious>
Fri, 6 Dec 2013 16:51:33 +0000 (20:51 +0400)
utils/__init__.py

index f6e64f2..d6ff895 100644 (file)
@@ -198,8 +198,8 @@ def DecodeBase58Check(psz):
 ########### end pywallet functions #######################
 
 def random_string(length):
-    return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(length))
-
+    with open("/dev/urandom", 'rb') as f:
+        return b58encode( f.read(length) )
 
 def timestr():
     return time.strftime("[%d/%m/%Y-%H:%M:%S]")