summaryrefslogtreecommitdiff
path: root/rsa/common.py
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2011-06-20 00:23:49 +0200
committerSybren A. Stüvel <sybren@stuvel.eu>2011-06-20 00:23:49 +0200
commitbc7f521f3334eb39f974e9f6c0bb38f64ae989f8 (patch)
tree4fd5b28051e465cc435353947d1a13699fc6b0b0 /rsa/common.py
parent2caf3a0299b54ad6e3333492eda56bde56376dd1 (diff)
downloadrsa-git-bc7f521f3334eb39f974e9f6c0bb38f64ae989f8.tar.gz
More separation of the code
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)))
+