summaryrefslogtreecommitdiff
path: root/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'rsa')
-rw-r--r--rsa/common.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/rsa/common.py b/rsa/common.py
index 4d7698f..33714a6 100644
--- a/rsa/common.py
+++ b/rsa/common.py
@@ -17,7 +17,6 @@
'''Common functionality shared by several modules.'''
-import math
def bit_size(number):
'''Returns the number of bits required to hold a specific long number.
@@ -67,7 +66,13 @@ def byte_size(number):
129
"""
- return int(math.ceil(bit_size(number) / 8.0))
+ # Does not perform floating-point division and uses built-in divmod
+ # operator.
+ quanta, mod = divmod(bit_size(number), 8)
+ if mod:
+ quanta += 1
+ return quanta
+ #return int(math.ceil(bit_size(number) / 8.0))
def extended_gcd(a, b):