diff --git a/ffi/python/Makefile b/ffi/python/Makefile new file mode 100644 index 0000000..1b4846f --- /dev/null +++ b/ffi/python/Makefile @@ -0,0 +1,9 @@ +include ../../common.mk + +SHE384_256_SLIB=libmclshe384_256.$(LIB_SUF) + +she_test: ../../lib/$(SHE384_256_SLIB) + env LD_LIBRARY_PATH=../../lib python3 she.py + +../../lib/$(SHE384_256_SLIB): + make -C ../../ lib/$(SHE384_256_SLIB) diff --git a/ffi/python/readme.md b/ffi/python/readme.md new file mode 100644 index 0000000..48479d1 --- /dev/null +++ b/ffi/python/readme.md @@ -0,0 +1,7 @@ +# sample for Python + +## SHE + +``` +make test_she +``` diff --git a/ffi/python/she.py b/ffi/python/she.py index 4234a67..538515f 100644 --- a/ffi/python/she.py +++ b/ffi/python/she.py @@ -1,6 +1,7 @@ import os import platform from ctypes import * +#from ctypes.util import find_library BN254 = 0 BLS12_381 = 5 @@ -34,6 +35,7 @@ def init(curveType=BN254): libName = 'mclshe384_256.dll' else: raise RuntimeError("not support yet", name) +# lib = cdll.LoadLibrary(find_library(libName)) lib = cdll.LoadLibrary(libName) ret = lib.sheInit(curveType, MCLBN_COMPILED_TIME_VAR) if ret != 0: