summaryrefslogtreecommitdiff
path: root/rsa/randnum.py
diff options
context:
space:
mode:
Diffstat (limited to 'rsa/randnum.py')
-rw-r--r--rsa/randnum.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/rsa/randnum.py b/rsa/randnum.py
index a6a635b..275da0f 100644
--- a/rsa/randnum.py
+++ b/rsa/randnum.py
@@ -21,6 +21,7 @@
import os
from rsa import common, transform
+from rsa._compat import byte
def read_random_bits(nbits):
'''Reads 'nbits' random bits.
@@ -38,7 +39,7 @@ def read_random_bits(nbits):
if rbits > 0:
randomvalue = ord(os.urandom(1))
randomvalue >>= (8 - rbits)
- randomdata = chr(randomvalue) + randomdata
+ randomdata = byte(randomvalue) + randomdata
return randomdata