1. Sybren Stüvel
  2. python-rsa

Commits

Barry Mead  committed 40683d7

Fixed range bug in randint -- never reached maxvalue

  • Participants
  • Parent commits 29507db
  • Branches default

Comments (0)

Files changed (2)

File rsa/__init__.py

View file
     min_nbits = 32
 
     # The range of the random numbers we need to generate
-    range = maxvalue - minvalue
+    range = (maxvalue - minvalue) + 1
 
     # Which is this number of bytes
     rangebytes = ((bit_size(range) + 7) / 8)

File rsa/fastrsa.py

View file
     min_nbits = 32
 
     # The range of the random numbers we need to generate
-    range = maxvalue - minvalue
+    range = (maxvalue - minvalue) + 1
 
     # Which is this number of bytes
     rangebytes = ((bit_size(range) + 7) / 8)