pylibswarm

Python3 wrapper for libswarm-ng
git clone git://git.defalsify.org/pylibswarm.git
Log | Files | Refs | Submodules | README | LICENSE

commit 71fbcb72534670a7068afce8a346753bfc61cfd7
parent 96292931f74fd4b24298bcf38cd18802a64fabb5
Author: nolash <dev@holbrook.no>
Date:   Fri, 17 Sep 2021 09:03:31 +0200

Pull soc changes from libswarm-ng

Diffstat:
Msetup.py | 13+++++++++++++
Msrc/python_swarm.c | 6+++---
2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py @@ -19,12 +19,25 @@ def main(): os.path.join(swarm_dir, 'src/bmt.c'), os.path.join(swarm_dir, 'src/endian.c'), os.path.join(swarm_dir, 'src/swarmfile.c'), + os.path.join(swarm_dir, 'src/chunk.c'), + os.path.join(swarm_dir, 'src/keystore.c'), + os.path.join(swarm_dir, 'src/soc.c'), + os.path.join(swarm_dir, 'src/swarm.c'), os.path.join(swarm_dir, 'aux/keccak-tiny/keccak-tiny.c'), ], include_dirs=[ os.path.join(swarm_dir, 'src'), os.path.join(swarm_dir, 'aux/keccak-tiny'), ], + library_dirs=[ + os.path.join(swarm_dir, 'aux/secp256k1/.libs'), + ], + runtime_library_dirs=[ + os.path.join(swarm_dir, 'aux/secp256k1/.libs'), + ], + libraries=[ + 'secp256k1', + ], extra_compile_args=[ '-Dmemset_s(W,WL,V,OL)=memset(W,V,OL)', ], diff --git a/src/python_swarm.c b/src/python_swarm.c @@ -12,7 +12,7 @@ static void filehash_callback(const char *hash, const char *data, size_t data_length, void *callback_static) { PyObject *callback = (PyObject*)callback_static; - PyObject_CallFunction(callback, "y#y#", hash, _SWARM_WORD_SIZE, data, data_length); + PyObject_CallFunction(callback, "y#y#", hash, SWARM_WORD_SIZE, data, data_length); } @@ -75,7 +75,7 @@ static PyObject* method_bmt(PyObject *self, PyObject *args) { bmt_init(&bctx, (char*)input, input_length, data_length); bmt_sum(&bctx); - return Py_BuildValue("y#", &bctx.buf, _SWARM_WORD_SIZE); + return Py_BuildValue("y#", &bctx.buf, SWARM_WORD_SIZE); } @@ -97,7 +97,7 @@ static PyObject* method_filehash_path(PyObject *self, PyObject *args) { } r = filehash_path(&fctx, inpath); - return Py_BuildValue("y#", &fctx.buf, _SWARM_WORD_SIZE); + return Py_BuildValue("y#", &fctx.buf, SWARM_WORD_SIZE); }