aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/bignum.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/test_framework/bignum.py')
-rw-r--r--test/functional/test_framework/bignum.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/test/functional/test_framework/bignum.py b/test/functional/test_framework/bignum.py
index 024611da6e..db5ccd62c2 100644
--- a/test/functional/test_framework/bignum.py
+++ b/test/functional/test_framework/bignum.py
@@ -26,12 +26,6 @@ def bn2bin(v):
i -= 1
return s
-def bin2bn(s):
- l = 0
- for ch in s:
- l = (l << 8) | ch
- return l
-
def bn2mpi(v):
have_ext = False
if v.bit_length() > 0:
@@ -54,30 +48,6 @@ def bn2mpi(v):
v_bin[0] |= 0x80
return s + ext + v_bin
-def mpi2bn(s):
- if len(s) < 4:
- return None
- s_size = bytes(s[:4])
- v_len = struct.unpack(b">I", s_size)[0]
- if len(s) != (v_len + 4):
- return None
- if v_len == 0:
- return 0
-
- v_str = bytearray(s[4:])
- neg = False
- i = v_str[0]
- if i & 0x80:
- neg = True
- i &= ~0x80
- v_str[0] = i
-
- v = bin2bn(v_str)
-
- if neg:
- return -v
- return v
-
# bitcoin-specific little endian format, with implicit size
def mpi2vch(s):
r = s[4:] # strip size
@@ -86,12 +56,3 @@ def mpi2vch(s):
def bn2vch(v):
return bytes(mpi2vch(bn2mpi(v)))
-
-def vch2mpi(s):
- r = struct.pack(b">I", len(s)) # size
- r += s[::-1] # reverse string, converting LE->BE
- return r
-
-def vch2bn(s):
- return mpi2bn(vch2mpi(s))
-