Skip to main content

Native crypto functions for the NEO 3 Blockchain

Project description

CoZ logo

NEO3VM

C++ implementations of cryptographic functions used in the NEO3 Blockchain with bindings for Python 3.10 & 3.11.

The current version supports mmh3 and EllipticCurve functions by wrapping (part of smhasher and micro-ecc) and exposing helper classes. SECP256R1 (a.k.a NIST256P) and SECP256K1 are the only curves exposed, but others can easily be enabled if needed.

Installation

pip install neo3crypto

Or download the wheels from the Github releases page.

Windows users

If installing fails with the error No Matching distribution found then upgrade your Python installation to use the latest post release version (i.e. 3.10.8 instead of 3.10.0)

Usage

import hashlib
import os
from neo3crypto import ECCCurve, ECPoint, sign, verify, mmh3_hash_bytes, mmh3_hash


curve = ECCCurve.SECP256R1
private_key = os.urandom(32)
public_key = ECPoint(private_key, curve)

signature = sign(private_key, b'message', curve, hashlib.sha256)
assert verify(signature, b'message', public_key, hashlib.sha256) == True

assert mmh3_hash("foo", signed=False) == 4138058784
assert bytes.fromhex("0bc59d0ad25fde2982ed65af61227a0e") == mmh3_hash_bytes("hello", 123)

Any hashlib hashing function can be used. Further documentation on the classes can be queried from the extension module using help(neo3crypto).

Building wheels

Make sure to have wheel and CMake installed. Then call python setup.py bdist_wheel.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

neo3crypto-0.4.3-cp312-cp312-win_amd64.whl (107.5 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

neo3crypto-0.4.3-cp312-cp312-musllinux_1_1_x86_64.whl (664.4 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

neo3crypto-0.4.3-cp312-cp312-musllinux_1_1_aarch64.whl (645.6 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

neo3crypto-0.4.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

neo3crypto-0.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (131.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

neo3crypto-0.4.3-cp312-cp312-macosx_11_0_arm64.whl (113.0 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

neo3crypto-0.4.3-cp312-cp312-macosx_10_9_x86_64.whl (120.0 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

neo3crypto-0.4.3-cp311-cp311-win_amd64.whl (106.2 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

neo3crypto-0.4.3-cp311-cp311-musllinux_1_1_x86_64.whl (665.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

neo3crypto-0.4.3-cp311-cp311-musllinux_1_1_aarch64.whl (645.1 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

neo3crypto-0.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

neo3crypto-0.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (132.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

neo3crypto-0.4.3-cp311-cp311-macosx_11_0_arm64.whl (111.3 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

neo3crypto-0.4.3-cp311-cp311-macosx_10_9_x86_64.whl (117.5 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page