summaryrefslogtreecommitdiff
path: root/rsa/common.py
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2011-06-20 00:49:31 +0200
committerSybren A. Stüvel <sybren@stuvel.eu>2011-06-20 00:49:31 +0200
commit0060065bf34d426bc634ff6dac1ac9475ca4687e (patch)
tree249a2f68325886936532aab4dac27e182dae0ac3 /rsa/common.py
parent0c466f19a9481867f29de3618b71e59148623892 (diff)
downloadrsa-git-0060065bf34d426bc634ff6dac1ac9475ca4687e.tar.gz
Fixed/added doctests
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)))