From c80f0fbc52ce0995aac027079c77e59f128726c6 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 4 Jul 2016 18:19:58 +0200 Subject: [PATCH] remove cpython wrapper - it's broken and nobody uses it --- .gitignore | 5 ----- MANIFEST.in | 2 -- TrezorCrypto.pyx | 40 ---------------------------------------- c.pxd | 22 ---------------------- test.py | 10 ---------- 5 files changed, 79 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 TrezorCrypto.pyx delete mode 100644 c.pxd delete mode 100755 test.py diff --git a/.gitignore b/.gitignore index f1da71bbc..c4255cff7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,6 @@ test-openssl test_speed tests -build-*/ -build/ -dist/ -MANIFEST -TrezorCrypto.c *.os *.so *.pyc diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 637fe68f5..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include *.h -include *.pyx diff --git a/TrezorCrypto.pyx b/TrezorCrypto.pyx deleted file mode 100644 index 71490f8f9..000000000 --- a/TrezorCrypto.pyx +++ /dev/null @@ -1,40 +0,0 @@ -cimport c -cimport cython - -cdef class HDNode: - - cdef c.HDNode node - - def __init__(self, str serialized = None, HDNode copyfrom = None): - if copyfrom is not None: - self.node = copyfrom.node - elif serialized is not None: - if c.hdnode_deserialize(serialized, cython.address(self.node)) != 0: - raise Exception('Invalid xpub/xprv provided') - else: - raise Exception('Need to provide serialized or node parameter') - - def xpub(self): - cdef char[120] string - c.hdnode_serialize_public(cython.address(self.node), string, 120) - return str(string) - - def xprv(self): - cdef char[120] string - c.hdnode_serialize_private(cython.address(self.node), string, 120) - return str(string) - - def address(self): - cdef char[40] string - c.ecdsa_get_address(self.node.public_key, 0, string, 40) - return str(string) - - def public_ckd(self, int i): - x = HDNode(copyfrom=self) - c.hdnode_public_ckd(cython.address(x.node), i) - return x - - def private_ckd(self, unsigned int i): - x = HDNode(copyfrom=self) - c.hdnode_private_ckd(cython.address(x.node), i) - return x diff --git a/c.pxd b/c.pxd deleted file mode 100644 index dc28f9c65..000000000 --- a/c.pxd +++ /dev/null @@ -1,22 +0,0 @@ -from libc.stdint cimport uint32_t, uint8_t - -cdef extern from "bip32.h": - - ctypedef struct HDNode: - uint8_t public_key[33] - - int hdnode_from_seed(const uint8_t *seed, int seed_len, const char *curve, HDNode *out) - - int hdnode_private_ckd(HDNode *inout, uint32_t i) - - int hdnode_public_ckd(HDNode *inout, uint32_t i) - - void hdnode_serialize_public(const HDNode *node, char *str, int strsize) - - void hdnode_serialize_private(const HDNode *node, char *str, int strsize) - - int hdnode_deserialize(const char *str, HDNode *node) - -cdef extern from "ecdsa.h": - - void ecdsa_get_address(const uint8_t *pub_key, uint8_t version, char *addr, int addrsize) diff --git a/test.py b/test.py deleted file mode 100755 index 088616d22..000000000 --- a/test.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/python -from TrezorCrypto import HDNode - -x = HDNode('xpub6BcjTvRCYD4VvFQ8whztSXhbNyhS56eTd5P3g9Zvd3zPEeUeL5CUqBYX8NSd1b6Thitr8bZcSnesmXZH7KerMcc4tUkenBShYCtQ1L8ebVe') - -y = x.public_ckd(0) - -for i in range(1000): - z = y.public_ckd(i) - print i, z.address()