summaryrefslogtreecommitdiff
path: root/rsa/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'rsa/common.py')
-rw-r--r--rsa/common.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rsa/common.py b/rsa/common.py
new file mode 100644
index 0000000..d00a44d
--- /dev/null
+++ b/rsa/common.py
@@ -0,0 +1,9 @@
+'''Common functionality shared by several modules.'''
+
+import math
+
+def bit_size(number):
+ """Returns the number of bits required to hold a specific long number"""
+
+ return int(math.ceil(math.log(number,2)))
+