All Projects → tuxxy → hazmat-math

tuxxy / hazmat-math

Licence: LGPL-3.0 license
Hazmat ECC arithmetic for Cryptography.io

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to hazmat-math

EllipticCurve
An elliptic curve library written in Swift 4
Stars: ✭ 18 (-35.71%)
Mutual labels:  ecc, elliptic-curves, secp256k1, elliptic-curve-arithmetic
nim-blscurve
Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Stars: ✭ 19 (-32.14%)
Mutual labels:  elliptic-curves, elliptic-curve-arithmetic
elliptic-curve
A polymorphic interface for elliptic curve operations
Stars: ✭ 37 (+32.14%)
Mutual labels:  ecc, elliptic-curves
noble-secp256k1
Fastest JS implementation of secp256k1. Independently audited, high-security, 0-dependency ECDSA & Schnorr signatures.
Stars: ✭ 313 (+1017.86%)
Mutual labels:  ecc, secp256k1
keystore-idb
In-browser key management with IndexedDB and the Web Crypto API
Stars: ✭ 37 (+32.14%)
Mutual labels:  ecc, elliptic-curves
pairing
Optimised bilinear pairings over elliptic curves
Stars: ✭ 44 (+57.14%)
Mutual labels:  ecc, elliptic-curves
secp256k1-ml
Elliptic curve library secp256k1 wrapper for Ocaml
Stars: ✭ 18 (-35.71%)
Mutual labels:  elliptic-curves, secp256k1
noble-ed25519
Fastest JS implementation of ed25519, x25519 & ristretto255. Independently audited, high-security, 0-dependency EDDSA signatures and ECDH key agreement
Stars: ✭ 220 (+685.71%)
Mutual labels:  ecc, elliptic-curves
Practical Cryptography For Developers Book
Practical Cryptography for Developers: Hashes, MAC, Key Derivation, DHKE, Symmetric and Asymmetric Ciphers, Public Key Cryptosystems, RSA, Elliptic Curves, ECC, secp256k1, ECDH, ECIES, Digital Signatures, ECDSA, EdDSA
Stars: ✭ 2,400 (+8471.43%)
Mutual labels:  ecc, elliptic-curves
libgoldilocks
An implementation of Mike Hamburg's Ed448 (Goldilocks) curve - derived from libdecaf. This is a mirror of https://bugs.otr.im/otrv4/libgoldilocks
Stars: ✭ 17 (-39.29%)
Mutual labels:  ecc, elliptic-curves
go
Elliptic Curve Integrated Encryption Scheme for secp256k1 in Golang
Stars: ✭ 56 (+100%)
Mutual labels:  secp256k1
jubjub
Supporting evidence for security of the Jubjub curve to be used in Zcash
Stars: ✭ 13 (-53.57%)
Mutual labels:  elliptic-curves
oxo-chat-app
基于websocket、json、blockchain的公告、聊天(客户端到客户端加密)客户端。账号无需注册,本地生成!
Stars: ✭ 20 (-28.57%)
Mutual labels:  secp256k1
galois
A performant NumPy extension for Galois fields and their applications
Stars: ✭ 106 (+278.57%)
Mutual labels:  elliptic-curves
bulletproofs
Bulletproofs and Bulletproofs+ Rust implementation for Aggregated Range Proofs over multiple elliptic curves
Stars: ✭ 62 (+121.43%)
Mutual labels:  elliptic-curves
ParPar
High performance PAR2 create client for NodeJS
Stars: ✭ 110 (+292.86%)
Mutual labels:  ecc
ethereum-checksum-address
Convert Ethereum address to a checksummed address
Stars: ✭ 20 (-28.57%)
Mutual labels:  secp256k1
btclib
btclib: a python3 library for 'bitcoin cryptography'
Stars: ✭ 60 (+114.29%)
Mutual labels:  elliptic-curves
elliptic-php
Fast, general Elliptic Curve Cryptography library. Supports curves used in Bitcoin, Ethereum and other cryptocurrencies (secp256k1, ed25519, ..)
Stars: ✭ 178 (+535.71%)
Mutual labels:  ecc
go-secp256k1
Go wrapper for secp256k1
Stars: ✭ 35 (+25%)
Mutual labels:  secp256k1

hazmat-math

Hazmat ECC arithmetic for Cryptography.io

Hazmat math implements some basic ECC arithmetic for use with Cryptography.io objects using the OpenSSL backend. Specifically, _EllipticCurvePrivateKey and _EllipticCurvePublicKey.

Any operations with EC_POINT will return an _EllipticCurvePublicKey and any operations with BN will return an _EllipticCurvePrivateKey.

Usage:

from cryptography.hazmat.backends import default_backend()
from cryptography.hazmat.primitives.asymmetric import ec

from hazmat_math import operations as ops


priv_a = ec.generate_private_keys(ec.SECP256K1(), default_backend())
priv_b = ec.generate_private_keys(ec.SECP256K1(), default_backend())

pub_a = priv_a.public_key()
pub_b = priv_b.public_key()

# Multiplication
priv_c = ops.BN_MOD_MUL(priv_a, priv_b)
pub_c = ops.EC_POINT_MUL(pub_a, priv_a)

# Division
priv_c = ops.BN_DIV(priv_a, priv_b)

# Inversion
inv_a_priv = ops.BN_MOD_INVERSE(priv_a)
inv_a_pub = ops.EC_POINT_INVERT(pub_a)

# Addition
priv_c = ops.BN_MOD_ADD(priv_a, priv_b)
pub_c = ops.EC_POINT_ADD(pub_a, pub_b)

# Subtraction
priv_c = ops.BN_MOD_SUB(priv_a, priv_b)
pub_c = ops.EC_POINT_SUB(pub_a, pub_b)

# Get generator point from curve
gen_point = ops.CURVE_GET_GENERATOR(ec.SECP256K1())

# Get order of curve
order = ops.CURVE_GET_ORDER(ec.SECP256K1())

Installation:

  1. Clone or download the repository
  2. Ensure that you have cryptography.io install (pip install cryptography)
  3. python setup.py install

TODO:

  1. Testing!
  2. Get setup on pypy.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].