| @@ -0,0 +1,27 @@ | |||||
| Installation | |||||
| ------------ | |||||
| The easiest way to install is to run the command: | |||||
| ``` | |||||
| pip install 'git+https://git.code.sf.net/p/ed448goldilocks/code#egg=edgold&subdirectory=python' | |||||
| ``` | |||||
| Usage | |||||
| ----- | |||||
| This wraps the Ed448 code into a simple to use class, EDDSA448. The | |||||
| easiest way to geenrate a new key is to use the generate class method. | |||||
| Example: | |||||
| ``` | |||||
| from edgold.ed448 import EDDSA448 | |||||
| key = EDDSA448.generate() | |||||
| privkey = key.export(key('raw') | |||||
| msg = b'This is a message to sign' | |||||
| sig = key.sign(msg) | |||||
| pubkey = key.public_key().export_key('raw') | |||||
| key = EDDSA448(pub=pubkey) | |||||
| key.verify(sig, msg) | |||||
| ``` | |||||
| @@ -1,6 +1,6 @@ | |||||
| #!/usr/bin/env python | #!/usr/bin/env python | ||||
| # | # | ||||
| # Copyright 2017 John-Mark Gurney. | |||||
| # Copyright 2017, 2022 John-Mark Gurney. | |||||
| # All rights reserved. | # All rights reserved. | ||||
| # | # | ||||
| # Redistribution and use in source and binary forms, with or without | # Redistribution and use in source and binary forms, with or without | ||||
| @@ -33,10 +33,11 @@ of signing due to the complexity of integration w/ the library, and | |||||
| that things should be more simple to use.''' | that things should be more simple to use.''' | ||||
| __author__ = 'John-Mark Gurney' | __author__ = 'John-Mark Gurney' | ||||
| __copyright__ = 'Copyright 2017 John-Mark Gurney''' | |||||
| __license__ = 'BSD' | |||||
| __version__ = '0.1' | |||||
| __status__ = 'alpha' | |||||
| __copyright__ = 'Copyright 2017, 2022 John-Mark Gurney''' | |||||
| __license__ = 'BSD-2-Clause' | |||||
| __version__ = '1.0' | |||||
| __all__ = [ 'EDDSA448', 'generate' ] | |||||
| import array | import array | ||||
| import os | import os | ||||
| @@ -94,13 +95,7 @@ def _makeba(s): | |||||
| return r | return r | ||||
| def _makestr(a): | def _makestr(a): | ||||
| # XXX - because python3 sucks, and unittest doesn't offer | |||||
| # ability to silence stupid warnings, hide the tostring | |||||
| # DeprecationWarning. | |||||
| with warnings.catch_warnings(): | |||||
| warnings.simplefilter('ignore') | |||||
| return array.array('B', a).tostring() | |||||
| return bytes(a) | |||||
| def _ed448_privkey(): | def _ed448_privkey(): | ||||
| return _makeba(os.urandom(DECAF_EDDSA_448_PRIVATE_BYTES)) | return _makeba(os.urandom(DECAF_EDDSA_448_PRIVATE_BYTES)) | ||||
| @@ -4,19 +4,22 @@ from distutils.command.build import build | |||||
| from distutils.core import setup | from distutils.core import setup | ||||
| import os | import os | ||||
| import sys | |||||
| libext = dict(darwin='.dylib').get(sys.platform, '.so') | |||||
| class my_build(build): | class my_build(build): | ||||
| def run(self): | def run(self): | ||||
| build.run(self) | build.run(self) | ||||
| if not self.dry_run: | if not self.dry_run: | ||||
| os.spawnlp(os.P_WAIT, 'sh', 'sh', '-c', 'cd .. && gmake lib') | |||||
| self.copy_file(os.path.join('..', 'build', 'lib', 'libdecaf.so'), os.path.join(self.build_lib, 'edgold')) | |||||
| os.spawnlp(os.P_WAIT, 'sh', 'sh', '-c', 'cd .. && mkdir build && cd build && cmake .. && make') | |||||
| self.copy_file(os.path.join('..', 'build', 'src', 'libdecaf.0' + libext), os.path.join(self.build_lib, 'edgold', 'libdecaf.so')) | |||||
| cmdclass = {} | cmdclass = {} | ||||
| cmdclass['build'] = my_build | cmdclass['build'] = my_build | ||||
| setup(name='edgold', | setup(name='edgold', | ||||
| version='0.1', | |||||
| version='1.0', | |||||
| description='The Ed ECC Goldilocks Python wrapper', | description='The Ed ECC Goldilocks Python wrapper', | ||||
| author='John-Mark Gurney', | author='John-Mark Gurney', | ||||
| author_email='jmg@funkthat.com', | author_email='jmg@funkthat.com', | ||||