summaryrefslogtreecommitdiff
path: root/rsa/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'rsa/common.py')
-rw-r--r--rsa/common.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/rsa/common.py b/rsa/common.py
index d00a44d..b8f7aa6 100644
--- a/rsa/common.py
+++ b/rsa/common.py
@@ -3,7 +3,16 @@
import math
def bit_size(number):
- """Returns the number of bits required to hold a specific long number"""
+ '''Returns the number of bits required to hold a specific long number.
- return int(math.ceil(math.log(number,2)))
+ >>> bit_size(1023)
+ 10
+ >>> bit_size(1024)
+ 10
+ >>> bit_size(1025)
+ 11
+
+ '''
+
+ return int(math.ceil(math.log(number, 2)))