charm-crypto-lite 0.61.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- charm_crypto_lite-0.61.1/MANIFEST.in +11 -0
- charm_crypto_lite-0.61.1/PKG-INFO +158 -0
- charm_crypto_lite-0.61.1/README.md +124 -0
- charm_crypto_lite-0.61.1/charm_crypto_lite.egg-info/PKG-INFO +158 -0
- charm_crypto_lite-0.61.1/charm_crypto_lite.egg-info/SOURCES.txt +24 -0
- charm_crypto_lite-0.61.1/charm_crypto_lite.egg-info/dependency_links.txt +1 -0
- charm_crypto_lite-0.61.1/charm_crypto_lite.egg-info/requires.txt +5 -0
- charm_crypto_lite-0.61.1/charm_crypto_lite.egg-info/top_level.txt +1 -0
- charm_crypto_lite-0.61.1/charm_lite/__init__.py +22 -0
- charm_crypto_lite-0.61.1/charm_lite/core/__init__.py +2 -0
- charm_crypto_lite-0.61.1/charm_lite/core/benchmark/benchmark_util.c +353 -0
- charm_crypto_lite-0.61.1/charm_lite/core/benchmark/benchmark_util.h +61 -0
- charm_crypto_lite-0.61.1/charm_lite/core/benchmark/benchmarkmodule.c +476 -0
- charm_crypto_lite-0.61.1/charm_lite/core/benchmark/benchmarkmodule.h +162 -0
- charm_crypto_lite-0.61.1/charm_lite/core/math/__init__.py +2 -0
- charm_crypto_lite-0.61.1/charm_lite/core/math/elliptic_curve/ecmodule.c +1986 -0
- charm_crypto_lite-0.61.1/charm_lite/core/math/elliptic_curve/ecmodule.h +230 -0
- charm_crypto_lite-0.61.1/charm_lite/core/utilities/base64.c +248 -0
- charm_crypto_lite-0.61.1/charm_lite/core/utilities/base64.h +15 -0
- charm_crypto_lite-0.61.1/charm_lite/toolbox/PKEnc.py +60 -0
- charm_crypto_lite-0.61.1/charm_lite/toolbox/__init__.py +15 -0
- charm_crypto_lite-0.61.1/charm_lite/toolbox/eccurve.py +12 -0
- charm_crypto_lite-0.61.1/charm_lite/toolbox/ecgroup.py +147 -0
- charm_crypto_lite-0.61.1/pyproject.toml +79 -0
- charm_crypto_lite-0.61.1/setup.cfg +4 -0
- charm_crypto_lite-0.61.1/setup.py +100 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: charm-crypto-lite
|
|
3
|
+
Version: 0.61.1
|
|
4
|
+
Summary: Lightweight elliptic curve cryptography from the Charm framework (OpenSSL-only, no GMP/PBC)
|
|
5
|
+
Author-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
6
|
+
Maintainer-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
7
|
+
Project-URL: Homepage, https://github.com/JHUISI/charm
|
|
8
|
+
Project-URL: Documentation, https://jhuisi.github.io/charm/
|
|
9
|
+
Project-URL: Repository, https://github.com/JHUISI/charm
|
|
10
|
+
Project-URL: Issues, https://github.com/JHUISI/charm/issues
|
|
11
|
+
Keywords: cryptography,elliptic curves,secp256k1,hash-to-curve,openssl
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Programming Language :: C
|
|
26
|
+
Classifier: Topic :: Security :: Cryptography
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build; extra == "dev"
|
|
33
|
+
Requires-Dist: twine; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# charm-crypto-lite
|
|
36
|
+
|
|
37
|
+
**Minimal elliptic curve cryptography for Python** — a lightweight subset of the [Charm Crypto Framework](https://github.com/JHUISI/charm).
|
|
38
|
+
|
|
39
|
+
## Why charm-crypto-lite?
|
|
40
|
+
|
|
41
|
+
| | charm-crypto-lite | charm-crypto-framework |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| **Python dependencies** | **None** | pyparsing |
|
|
44
|
+
| **C library dependencies** | OpenSSL only | OpenSSL + GMP + PBC |
|
|
45
|
+
| **Scope** | secp256k1 EC operations | Full crypto toolkit |
|
|
46
|
+
| **Use case** | ECDSA, Schnorr, ECDH | ABE, IBE, pairing-based crypto |
|
|
47
|
+
|
|
48
|
+
**Use charm-crypto-lite if you:**
|
|
49
|
+
- Only need elliptic curve operations on secp256k1 (Bitcoin/Ethereum curve)
|
|
50
|
+
- Want zero Python dependencies and minimal C dependencies
|
|
51
|
+
- Need a lightweight package for serverless/containerized environments
|
|
52
|
+
|
|
53
|
+
**Use [charm-crypto-framework](https://pypi.org/project/charm-crypto-framework/) if you:**
|
|
54
|
+
- Need pairing-based cryptography (ABE, IBE, signatures)
|
|
55
|
+
- Need multiple curve types or pairing groups
|
|
56
|
+
- Are building advanced cryptographic protocols
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install charm-crypto-lite
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Prerequisites:** OpenSSL development libraries
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# macOS
|
|
68
|
+
brew install openssl
|
|
69
|
+
|
|
70
|
+
# Ubuntu/Debian
|
|
71
|
+
sudo apt-get install libssl-dev python3-dev build-essential
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR, G
|
|
78
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
79
|
+
|
|
80
|
+
group = ECGroup(secp256k1)
|
|
81
|
+
|
|
82
|
+
# Get the generator point
|
|
83
|
+
g = group.generator()
|
|
84
|
+
|
|
85
|
+
# Generate random scalar (private key)
|
|
86
|
+
x = group.random(ZR)
|
|
87
|
+
|
|
88
|
+
# Scalar multiplication: public_key = g^x
|
|
89
|
+
pk = g ** x
|
|
90
|
+
|
|
91
|
+
# Point addition (multiplicative notation): p = h * k
|
|
92
|
+
h = g ** group.random(ZR)
|
|
93
|
+
p = pk * h
|
|
94
|
+
|
|
95
|
+
# Serialization
|
|
96
|
+
data = group.serialize(pk)
|
|
97
|
+
pk2 = group.deserialize(data)
|
|
98
|
+
assert pk == pk2
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## API Reference
|
|
102
|
+
|
|
103
|
+
### ECGroup Operations
|
|
104
|
+
|
|
105
|
+
| Operation | Syntax | Description |
|
|
106
|
+
|-----------|--------|-------------|
|
|
107
|
+
| Generator | `group.generator()` | Get curve generator point G |
|
|
108
|
+
| Random scalar | `group.random(ZR)` | Random scalar in field |
|
|
109
|
+
| Random point | `group.random(G)` | Random point on curve |
|
|
110
|
+
| Scalar multiply | `g ** x` | Point × scalar |
|
|
111
|
+
| Point add | `h * k` | Point + point (multiplicative notation) |
|
|
112
|
+
| Point negate | `-h` | Additive inverse |
|
|
113
|
+
| Scalar add | `x + y` | Field addition |
|
|
114
|
+
| Scalar multiply | `x * y` | Field multiplication |
|
|
115
|
+
| Scalar invert | `~x` | Multiplicative inverse |
|
|
116
|
+
| Serialize | `group.serialize(elem)` | To bytes |
|
|
117
|
+
| Deserialize | `group.deserialize(data)` | From bytes |
|
|
118
|
+
| Group order | `group.order()` | Curve order n |
|
|
119
|
+
|
|
120
|
+
### PKEnc Base Class
|
|
121
|
+
|
|
122
|
+
For building encryption schemes:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from charm_lite.toolbox.PKEnc import PKEnc
|
|
126
|
+
|
|
127
|
+
class MyScheme(PKEnc):
|
|
128
|
+
def keygen(self): ...
|
|
129
|
+
def encrypt(self, pk, msg): ...
|
|
130
|
+
def decrypt(self, sk, ct): ...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Migrating to Full Charm
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip uninstall charm-crypto-lite
|
|
137
|
+
pip install charm-crypto-framework
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Change imports from `charm_lite` to `charm`:
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Before
|
|
144
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
145
|
+
|
|
146
|
+
# After
|
|
147
|
+
from charm.toolbox.ecgroup import ECGroup
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
LGPL-3.0-or-later
|
|
153
|
+
|
|
154
|
+
## Links
|
|
155
|
+
|
|
156
|
+
- [Charm Crypto Framework](https://github.com/JHUISI/charm)
|
|
157
|
+
- [Documentation](https://jhuisi.github.io/charm/)
|
|
158
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# charm-crypto-lite
|
|
2
|
+
|
|
3
|
+
**Minimal elliptic curve cryptography for Python** — a lightweight subset of the [Charm Crypto Framework](https://github.com/JHUISI/charm).
|
|
4
|
+
|
|
5
|
+
## Why charm-crypto-lite?
|
|
6
|
+
|
|
7
|
+
| | charm-crypto-lite | charm-crypto-framework |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **Python dependencies** | **None** | pyparsing |
|
|
10
|
+
| **C library dependencies** | OpenSSL only | OpenSSL + GMP + PBC |
|
|
11
|
+
| **Scope** | secp256k1 EC operations | Full crypto toolkit |
|
|
12
|
+
| **Use case** | ECDSA, Schnorr, ECDH | ABE, IBE, pairing-based crypto |
|
|
13
|
+
|
|
14
|
+
**Use charm-crypto-lite if you:**
|
|
15
|
+
- Only need elliptic curve operations on secp256k1 (Bitcoin/Ethereum curve)
|
|
16
|
+
- Want zero Python dependencies and minimal C dependencies
|
|
17
|
+
- Need a lightweight package for serverless/containerized environments
|
|
18
|
+
|
|
19
|
+
**Use [charm-crypto-framework](https://pypi.org/project/charm-crypto-framework/) if you:**
|
|
20
|
+
- Need pairing-based cryptography (ABE, IBE, signatures)
|
|
21
|
+
- Need multiple curve types or pairing groups
|
|
22
|
+
- Are building advanced cryptographic protocols
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install charm-crypto-lite
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Prerequisites:** OpenSSL development libraries
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# macOS
|
|
34
|
+
brew install openssl
|
|
35
|
+
|
|
36
|
+
# Ubuntu/Debian
|
|
37
|
+
sudo apt-get install libssl-dev python3-dev build-essential
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR, G
|
|
44
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
45
|
+
|
|
46
|
+
group = ECGroup(secp256k1)
|
|
47
|
+
|
|
48
|
+
# Get the generator point
|
|
49
|
+
g = group.generator()
|
|
50
|
+
|
|
51
|
+
# Generate random scalar (private key)
|
|
52
|
+
x = group.random(ZR)
|
|
53
|
+
|
|
54
|
+
# Scalar multiplication: public_key = g^x
|
|
55
|
+
pk = g ** x
|
|
56
|
+
|
|
57
|
+
# Point addition (multiplicative notation): p = h * k
|
|
58
|
+
h = g ** group.random(ZR)
|
|
59
|
+
p = pk * h
|
|
60
|
+
|
|
61
|
+
# Serialization
|
|
62
|
+
data = group.serialize(pk)
|
|
63
|
+
pk2 = group.deserialize(data)
|
|
64
|
+
assert pk == pk2
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Reference
|
|
68
|
+
|
|
69
|
+
### ECGroup Operations
|
|
70
|
+
|
|
71
|
+
| Operation | Syntax | Description |
|
|
72
|
+
|-----------|--------|-------------|
|
|
73
|
+
| Generator | `group.generator()` | Get curve generator point G |
|
|
74
|
+
| Random scalar | `group.random(ZR)` | Random scalar in field |
|
|
75
|
+
| Random point | `group.random(G)` | Random point on curve |
|
|
76
|
+
| Scalar multiply | `g ** x` | Point × scalar |
|
|
77
|
+
| Point add | `h * k` | Point + point (multiplicative notation) |
|
|
78
|
+
| Point negate | `-h` | Additive inverse |
|
|
79
|
+
| Scalar add | `x + y` | Field addition |
|
|
80
|
+
| Scalar multiply | `x * y` | Field multiplication |
|
|
81
|
+
| Scalar invert | `~x` | Multiplicative inverse |
|
|
82
|
+
| Serialize | `group.serialize(elem)` | To bytes |
|
|
83
|
+
| Deserialize | `group.deserialize(data)` | From bytes |
|
|
84
|
+
| Group order | `group.order()` | Curve order n |
|
|
85
|
+
|
|
86
|
+
### PKEnc Base Class
|
|
87
|
+
|
|
88
|
+
For building encryption schemes:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from charm_lite.toolbox.PKEnc import PKEnc
|
|
92
|
+
|
|
93
|
+
class MyScheme(PKEnc):
|
|
94
|
+
def keygen(self): ...
|
|
95
|
+
def encrypt(self, pk, msg): ...
|
|
96
|
+
def decrypt(self, sk, ct): ...
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Migrating to Full Charm
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip uninstall charm-crypto-lite
|
|
103
|
+
pip install charm-crypto-framework
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Change imports from `charm_lite` to `charm`:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
# Before
|
|
110
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
111
|
+
|
|
112
|
+
# After
|
|
113
|
+
from charm.toolbox.ecgroup import ECGroup
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
LGPL-3.0-or-later
|
|
119
|
+
|
|
120
|
+
## Links
|
|
121
|
+
|
|
122
|
+
- [Charm Crypto Framework](https://github.com/JHUISI/charm)
|
|
123
|
+
- [Documentation](https://jhuisi.github.io/charm/)
|
|
124
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: charm-crypto-lite
|
|
3
|
+
Version: 0.61.1
|
|
4
|
+
Summary: Lightweight elliptic curve cryptography from the Charm framework (OpenSSL-only, no GMP/PBC)
|
|
5
|
+
Author-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
6
|
+
Maintainer-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
7
|
+
Project-URL: Homepage, https://github.com/JHUISI/charm
|
|
8
|
+
Project-URL: Documentation, https://jhuisi.github.io/charm/
|
|
9
|
+
Project-URL: Repository, https://github.com/JHUISI/charm
|
|
10
|
+
Project-URL: Issues, https://github.com/JHUISI/charm/issues
|
|
11
|
+
Keywords: cryptography,elliptic curves,secp256k1,hash-to-curve,openssl
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Programming Language :: C
|
|
26
|
+
Classifier: Topic :: Security :: Cryptography
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build; extra == "dev"
|
|
33
|
+
Requires-Dist: twine; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# charm-crypto-lite
|
|
36
|
+
|
|
37
|
+
**Minimal elliptic curve cryptography for Python** — a lightweight subset of the [Charm Crypto Framework](https://github.com/JHUISI/charm).
|
|
38
|
+
|
|
39
|
+
## Why charm-crypto-lite?
|
|
40
|
+
|
|
41
|
+
| | charm-crypto-lite | charm-crypto-framework |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| **Python dependencies** | **None** | pyparsing |
|
|
44
|
+
| **C library dependencies** | OpenSSL only | OpenSSL + GMP + PBC |
|
|
45
|
+
| **Scope** | secp256k1 EC operations | Full crypto toolkit |
|
|
46
|
+
| **Use case** | ECDSA, Schnorr, ECDH | ABE, IBE, pairing-based crypto |
|
|
47
|
+
|
|
48
|
+
**Use charm-crypto-lite if you:**
|
|
49
|
+
- Only need elliptic curve operations on secp256k1 (Bitcoin/Ethereum curve)
|
|
50
|
+
- Want zero Python dependencies and minimal C dependencies
|
|
51
|
+
- Need a lightweight package for serverless/containerized environments
|
|
52
|
+
|
|
53
|
+
**Use [charm-crypto-framework](https://pypi.org/project/charm-crypto-framework/) if you:**
|
|
54
|
+
- Need pairing-based cryptography (ABE, IBE, signatures)
|
|
55
|
+
- Need multiple curve types or pairing groups
|
|
56
|
+
- Are building advanced cryptographic protocols
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install charm-crypto-lite
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Prerequisites:** OpenSSL development libraries
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# macOS
|
|
68
|
+
brew install openssl
|
|
69
|
+
|
|
70
|
+
# Ubuntu/Debian
|
|
71
|
+
sudo apt-get install libssl-dev python3-dev build-essential
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR, G
|
|
78
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
79
|
+
|
|
80
|
+
group = ECGroup(secp256k1)
|
|
81
|
+
|
|
82
|
+
# Get the generator point
|
|
83
|
+
g = group.generator()
|
|
84
|
+
|
|
85
|
+
# Generate random scalar (private key)
|
|
86
|
+
x = group.random(ZR)
|
|
87
|
+
|
|
88
|
+
# Scalar multiplication: public_key = g^x
|
|
89
|
+
pk = g ** x
|
|
90
|
+
|
|
91
|
+
# Point addition (multiplicative notation): p = h * k
|
|
92
|
+
h = g ** group.random(ZR)
|
|
93
|
+
p = pk * h
|
|
94
|
+
|
|
95
|
+
# Serialization
|
|
96
|
+
data = group.serialize(pk)
|
|
97
|
+
pk2 = group.deserialize(data)
|
|
98
|
+
assert pk == pk2
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## API Reference
|
|
102
|
+
|
|
103
|
+
### ECGroup Operations
|
|
104
|
+
|
|
105
|
+
| Operation | Syntax | Description |
|
|
106
|
+
|-----------|--------|-------------|
|
|
107
|
+
| Generator | `group.generator()` | Get curve generator point G |
|
|
108
|
+
| Random scalar | `group.random(ZR)` | Random scalar in field |
|
|
109
|
+
| Random point | `group.random(G)` | Random point on curve |
|
|
110
|
+
| Scalar multiply | `g ** x` | Point × scalar |
|
|
111
|
+
| Point add | `h * k` | Point + point (multiplicative notation) |
|
|
112
|
+
| Point negate | `-h` | Additive inverse |
|
|
113
|
+
| Scalar add | `x + y` | Field addition |
|
|
114
|
+
| Scalar multiply | `x * y` | Field multiplication |
|
|
115
|
+
| Scalar invert | `~x` | Multiplicative inverse |
|
|
116
|
+
| Serialize | `group.serialize(elem)` | To bytes |
|
|
117
|
+
| Deserialize | `group.deserialize(data)` | From bytes |
|
|
118
|
+
| Group order | `group.order()` | Curve order n |
|
|
119
|
+
|
|
120
|
+
### PKEnc Base Class
|
|
121
|
+
|
|
122
|
+
For building encryption schemes:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from charm_lite.toolbox.PKEnc import PKEnc
|
|
126
|
+
|
|
127
|
+
class MyScheme(PKEnc):
|
|
128
|
+
def keygen(self): ...
|
|
129
|
+
def encrypt(self, pk, msg): ...
|
|
130
|
+
def decrypt(self, sk, ct): ...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Migrating to Full Charm
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip uninstall charm-crypto-lite
|
|
137
|
+
pip install charm-crypto-framework
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Change imports from `charm_lite` to `charm`:
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Before
|
|
144
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
145
|
+
|
|
146
|
+
# After
|
|
147
|
+
from charm.toolbox.ecgroup import ECGroup
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
LGPL-3.0-or-later
|
|
153
|
+
|
|
154
|
+
## Links
|
|
155
|
+
|
|
156
|
+
- [Charm Crypto Framework](https://github.com/JHUISI/charm)
|
|
157
|
+
- [Documentation](https://jhuisi.github.io/charm/)
|
|
158
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
charm_crypto_lite.egg-info/PKG-INFO
|
|
6
|
+
charm_crypto_lite.egg-info/SOURCES.txt
|
|
7
|
+
charm_crypto_lite.egg-info/dependency_links.txt
|
|
8
|
+
charm_crypto_lite.egg-info/requires.txt
|
|
9
|
+
charm_crypto_lite.egg-info/top_level.txt
|
|
10
|
+
charm_lite/__init__.py
|
|
11
|
+
charm_lite/core/__init__.py
|
|
12
|
+
charm_lite/core/benchmark/benchmark_util.c
|
|
13
|
+
charm_lite/core/benchmark/benchmark_util.h
|
|
14
|
+
charm_lite/core/benchmark/benchmarkmodule.c
|
|
15
|
+
charm_lite/core/benchmark/benchmarkmodule.h
|
|
16
|
+
charm_lite/core/math/__init__.py
|
|
17
|
+
charm_lite/core/math/elliptic_curve/ecmodule.c
|
|
18
|
+
charm_lite/core/math/elliptic_curve/ecmodule.h
|
|
19
|
+
charm_lite/core/utilities/base64.c
|
|
20
|
+
charm_lite/core/utilities/base64.h
|
|
21
|
+
charm_lite/toolbox/PKEnc.py
|
|
22
|
+
charm_lite/toolbox/__init__.py
|
|
23
|
+
charm_lite/toolbox/eccurve.py
|
|
24
|
+
charm_lite/toolbox/ecgroup.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
charm_lite
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
charm-crypto-lite: Lightweight elliptic curve cryptography from the Charm framework.
|
|
3
|
+
|
|
4
|
+
This package provides OpenSSL-based elliptic curve operations without
|
|
5
|
+
GMP or PBC dependencies.
|
|
6
|
+
|
|
7
|
+
Example usage:
|
|
8
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
9
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
10
|
+
|
|
11
|
+
group = ECGroup(secp256k1)
|
|
12
|
+
g = group.random(G)
|
|
13
|
+
x = group.random(ZR)
|
|
14
|
+
h = g ** x
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
# Preload benchmark module to ensure symbols are available
|
|
18
|
+
import charm_lite.core.benchmark
|
|
19
|
+
|
|
20
|
+
__version__ = "0.1.0"
|
|
21
|
+
__all__ = ['__version__']
|
|
22
|
+
|