streaming-crypto 0.0.0__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.
@@ -0,0 +1,388 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aes"
7
+ version = "0.7.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
10
+ dependencies = [
11
+ "cfg-if",
12
+ "cipher",
13
+ "cpufeatures",
14
+ "opaque-debug",
15
+ ]
16
+
17
+ [[package]]
18
+ name = "autocfg"
19
+ version = "1.5.0"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
22
+
23
+ [[package]]
24
+ name = "block-buffer"
25
+ version = "0.10.4"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
28
+ dependencies = [
29
+ "generic-array",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "cfg-if"
34
+ version = "1.0.4"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
37
+
38
+ [[package]]
39
+ name = "cipher"
40
+ version = "0.3.0"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
43
+ dependencies = [
44
+ "generic-array",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "core-api"
49
+ version = "0.1.0"
50
+
51
+ [[package]]
52
+ name = "cpufeatures"
53
+ version = "0.2.17"
54
+ source = "registry+https://github.com/rust-lang/crates.io-index"
55
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
56
+ dependencies = [
57
+ "libc",
58
+ ]
59
+
60
+ [[package]]
61
+ name = "crypto-common"
62
+ version = "0.1.7"
63
+ source = "registry+https://github.com/rust-lang/crates.io-index"
64
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
65
+ dependencies = [
66
+ "generic-array",
67
+ "typenum",
68
+ ]
69
+
70
+ [[package]]
71
+ name = "digest"
72
+ version = "0.10.7"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
75
+ dependencies = [
76
+ "block-buffer",
77
+ "crypto-common",
78
+ ]
79
+
80
+ [[package]]
81
+ name = "ffi-api"
82
+ version = "0.1.0"
83
+ dependencies = [
84
+ "core-api",
85
+ ]
86
+
87
+ [[package]]
88
+ name = "generic-array"
89
+ version = "0.14.7"
90
+ source = "registry+https://github.com/rust-lang/crates.io-index"
91
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
92
+ dependencies = [
93
+ "typenum",
94
+ "version_check",
95
+ ]
96
+
97
+ [[package]]
98
+ name = "getrandom"
99
+ version = "0.2.17"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
102
+ dependencies = [
103
+ "cfg-if",
104
+ "libc",
105
+ "wasi",
106
+ ]
107
+
108
+ [[package]]
109
+ name = "heck"
110
+ version = "0.5.0"
111
+ source = "registry+https://github.com/rust-lang/crates.io-index"
112
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
113
+
114
+ [[package]]
115
+ name = "indoc"
116
+ version = "2.0.7"
117
+ source = "registry+https://github.com/rust-lang/crates.io-index"
118
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
119
+ dependencies = [
120
+ "rustversion",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "libc"
125
+ version = "0.2.182"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
128
+
129
+ [[package]]
130
+ name = "memoffset"
131
+ version = "0.9.1"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
134
+ dependencies = [
135
+ "autocfg",
136
+ ]
137
+
138
+ [[package]]
139
+ name = "once_cell"
140
+ version = "1.21.3"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
143
+
144
+ [[package]]
145
+ name = "opaque-debug"
146
+ version = "0.3.1"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
149
+
150
+ [[package]]
151
+ name = "portable-atomic"
152
+ version = "1.13.1"
153
+ source = "registry+https://github.com/rust-lang/crates.io-index"
154
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
155
+
156
+ [[package]]
157
+ name = "ppv-lite86"
158
+ version = "0.2.21"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
161
+ dependencies = [
162
+ "zerocopy",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "proc-macro2"
167
+ version = "1.0.106"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
170
+ dependencies = [
171
+ "unicode-ident",
172
+ ]
173
+
174
+ [[package]]
175
+ name = "pyo3"
176
+ version = "0.22.6"
177
+ source = "registry+https://github.com/rust-lang/crates.io-index"
178
+ checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
179
+ dependencies = [
180
+ "cfg-if",
181
+ "indoc",
182
+ "libc",
183
+ "memoffset",
184
+ "once_cell",
185
+ "portable-atomic",
186
+ "pyo3-build-config",
187
+ "pyo3-ffi",
188
+ "pyo3-macros",
189
+ "unindent",
190
+ ]
191
+
192
+ [[package]]
193
+ name = "pyo3-api"
194
+ version = "0.1.0"
195
+ dependencies = [
196
+ "core-api",
197
+ "pyo3",
198
+ ]
199
+
200
+ [[package]]
201
+ name = "pyo3-build-config"
202
+ version = "0.22.6"
203
+ source = "registry+https://github.com/rust-lang/crates.io-index"
204
+ checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
205
+ dependencies = [
206
+ "once_cell",
207
+ "target-lexicon",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "pyo3-ffi"
212
+ version = "0.22.6"
213
+ source = "registry+https://github.com/rust-lang/crates.io-index"
214
+ checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
215
+ dependencies = [
216
+ "libc",
217
+ "pyo3-build-config",
218
+ ]
219
+
220
+ [[package]]
221
+ name = "pyo3-macros"
222
+ version = "0.22.6"
223
+ source = "registry+https://github.com/rust-lang/crates.io-index"
224
+ checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
225
+ dependencies = [
226
+ "proc-macro2",
227
+ "pyo3-macros-backend",
228
+ "quote",
229
+ "syn",
230
+ ]
231
+
232
+ [[package]]
233
+ name = "pyo3-macros-backend"
234
+ version = "0.22.6"
235
+ source = "registry+https://github.com/rust-lang/crates.io-index"
236
+ checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
237
+ dependencies = [
238
+ "heck",
239
+ "proc-macro2",
240
+ "pyo3-build-config",
241
+ "quote",
242
+ "syn",
243
+ ]
244
+
245
+ [[package]]
246
+ name = "quote"
247
+ version = "1.0.44"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
250
+ dependencies = [
251
+ "proc-macro2",
252
+ ]
253
+
254
+ [[package]]
255
+ name = "rand"
256
+ version = "0.8.5"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
259
+ dependencies = [
260
+ "libc",
261
+ "rand_chacha",
262
+ "rand_core",
263
+ ]
264
+
265
+ [[package]]
266
+ name = "rand_chacha"
267
+ version = "0.3.1"
268
+ source = "registry+https://github.com/rust-lang/crates.io-index"
269
+ checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
270
+ dependencies = [
271
+ "ppv-lite86",
272
+ "rand_core",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "rand_core"
277
+ version = "0.6.4"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
280
+ dependencies = [
281
+ "getrandom",
282
+ ]
283
+
284
+ [[package]]
285
+ name = "rustversion"
286
+ version = "1.0.22"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
289
+
290
+ [[package]]
291
+ name = "sha2"
292
+ version = "0.10.9"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
295
+ dependencies = [
296
+ "cfg-if",
297
+ "cpufeatures",
298
+ "digest",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "streaming-crypto"
303
+ version = "0.1.0-alpha.12"
304
+ dependencies = [
305
+ "aes",
306
+ "pyo3",
307
+ "rand",
308
+ "sha2",
309
+ "streaming-crypto 0.1.0-alpha.12 (registry+https://github.com/rust-lang/crates.io-index)",
310
+ ]
311
+
312
+ [[package]]
313
+ name = "streaming-crypto"
314
+ version = "0.1.0-alpha.12"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "43712bc27a14352ce7fbf03834517c22467e4b4ee41f06102ef4b2fb18021ac3"
317
+ dependencies = [
318
+ "aes",
319
+ "rand",
320
+ "sha2",
321
+ ]
322
+
323
+ [[package]]
324
+ name = "syn"
325
+ version = "2.0.117"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
328
+ dependencies = [
329
+ "proc-macro2",
330
+ "quote",
331
+ "unicode-ident",
332
+ ]
333
+
334
+ [[package]]
335
+ name = "target-lexicon"
336
+ version = "0.12.16"
337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
338
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
339
+
340
+ [[package]]
341
+ name = "typenum"
342
+ version = "1.19.0"
343
+ source = "registry+https://github.com/rust-lang/crates.io-index"
344
+ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
345
+
346
+ [[package]]
347
+ name = "unicode-ident"
348
+ version = "1.0.24"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
351
+
352
+ [[package]]
353
+ name = "unindent"
354
+ version = "0.2.4"
355
+ source = "registry+https://github.com/rust-lang/crates.io-index"
356
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
357
+
358
+ [[package]]
359
+ name = "version_check"
360
+ version = "0.9.5"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
363
+
364
+ [[package]]
365
+ name = "wasi"
366
+ version = "0.11.1+wasi-snapshot-preview1"
367
+ source = "registry+https://github.com/rust-lang/crates.io-index"
368
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
369
+
370
+ [[package]]
371
+ name = "zerocopy"
372
+ version = "0.8.40"
373
+ source = "registry+https://github.com/rust-lang/crates.io-index"
374
+ checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5"
375
+ dependencies = [
376
+ "zerocopy-derive",
377
+ ]
378
+
379
+ [[package]]
380
+ name = "zerocopy-derive"
381
+ version = "0.8.40"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953"
384
+ dependencies = [
385
+ "proc-macro2",
386
+ "quote",
387
+ "syn",
388
+ ]
@@ -0,0 +1,11 @@
1
+ [workspace]
2
+ members = ["streaming-crypto"]
3
+
4
+ resolver = "2"
5
+
6
+ [workspace.dependencies]
7
+ # --- DEPENDENCIES COMMON START ---
8
+ rand = "0.8"
9
+ aes = "0.7"
10
+ sha2 = "0.10"
11
+ # --- DEPENDENCIES COMMON END ---
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: streaming-crypto
3
+ Version: 0.0.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Python :: 3 :: Only
7
+ Classifier: Programming Language :: Python :: Implementation :: CPython
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ License-File: LICENSE
11
+ Summary: High-performance streaming encryption library powered by Rust
12
+ Author: Engr. Rejwanul Islam
13
+ License: MIT
14
+ Requires-Python: >=3.12
15
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
16
+
17
+ # streaming-crypto
18
+
19
+ [![CI](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml/badge.svg)](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml)
20
+ [![Crates.io](https://img.shields.io/crates/v/streaming-crypto.svg)](https://crates.io/crates/streaming-crypto)
21
+ [![Docs.rs](https://docs.rs/streaming-crypto/badge.svg)](https://docs.rs/streaming-crypto)
22
+ [![PyPI](https://img.shields.io/pypi/v/streaming-crypto.svg)](https://pypi.org/project/streaming-crypto/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
24
+
25
+ A Rust cryptographic library with optional FFI and Python bindings.
26
+
27
+ ---
28
+
29
+ ## Features
30
+
31
+ - **Rust API** (default): Pure Rust functions.
32
+ - **FFI API**: C ABI functions for integration with C/C++ and other languages.
33
+ - **PyO3 API**: Python bindings, installable via `pip`.
34
+
35
+ ---
36
+
37
+ ## Usage
38
+
39
+ ### Rust API
40
+
41
+ ```bash
42
+ cargo add streaming-crypto
43
+ ```
44
+
45
+ ### FFI API
46
+
47
+ ```bash
48
+ cargo build --features ffi-api
49
+ ```
50
+
51
+ ### Python API
52
+
53
+ ```bash
54
+ pip install streaming-crypto
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Documentation
60
+
61
+ - [API Docs on docs.rs](https://docs.rs/streaming-crypto)
62
+ - [Crate on crates.io](https://crates.io/crates/streaming-crypto)
63
+ - [PyPI package](https://pypi.org/project/streaming-crypto/)
64
+
65
+ ---
66
+
67
+ ## ✅ Badge Breakdown
68
+
69
+ - **CI badge** → shows GitHub Actions build/test status.
70
+ - **Crates.io badge** → shows latest published version on crates.io.
71
+ - **Docs.rs badge** → links to auto‑generated Rust documentation.
72
+ - **PyPI badge** → shows latest published version on PyPI.
73
+ - **License badge** → signals open‑source license clearly.
74
+
75
+ ---
76
+
77
+ ## Set environment python for test
78
+
79
+ 1. **Before:** PyO3 was trying to link against Python 3.13 because either a cached build or environment variable made it think our Python was 3.13.
80
+
81
+ 2. **Action:** We forced PyO3 to use Python 3.12 or current version of `pyenv` explicitly:
82
+
83
+ ```bash
84
+ export PYTHON_SYS_EXECUTABLE="$(pyenv which python3)"
85
+ export PYO3_PYTHON="$(pyenv which python3)"
86
+ export PYO3_NO_PYTHON_LINK=1
87
+
88
+ cargo clean
89
+ cargo test -p pyo3-api
90
+ ```
91
+
92
+ 3. **Result:** Cargo rebuilds PyO3 and all dependent crates from scratch. Now `cargo run --bin check_python` correctly detects Python 3.12.12 and does **not crash on missing libpython3.13.dylib**.
93
+
94
+ 4. **cargo test** will work now
95
+
@@ -0,0 +1,78 @@
1
+ # streaming-crypto
2
+
3
+ [![CI](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml/badge.svg)](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml)
4
+ [![Crates.io](https://img.shields.io/crates/v/streaming-crypto.svg)](https://crates.io/crates/streaming-crypto)
5
+ [![Docs.rs](https://docs.rs/streaming-crypto/badge.svg)](https://docs.rs/streaming-crypto)
6
+ [![PyPI](https://img.shields.io/pypi/v/streaming-crypto.svg)](https://pypi.org/project/streaming-crypto/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+
9
+ A Rust cryptographic library with optional FFI and Python bindings.
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ - **Rust API** (default): Pure Rust functions.
16
+ - **FFI API**: C ABI functions for integration with C/C++ and other languages.
17
+ - **PyO3 API**: Python bindings, installable via `pip`.
18
+
19
+ ---
20
+
21
+ ## Usage
22
+
23
+ ### Rust API
24
+
25
+ ```bash
26
+ cargo add streaming-crypto
27
+ ```
28
+
29
+ ### FFI API
30
+
31
+ ```bash
32
+ cargo build --features ffi-api
33
+ ```
34
+
35
+ ### Python API
36
+
37
+ ```bash
38
+ pip install streaming-crypto
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Documentation
44
+
45
+ - [API Docs on docs.rs](https://docs.rs/streaming-crypto)
46
+ - [Crate on crates.io](https://crates.io/crates/streaming-crypto)
47
+ - [PyPI package](https://pypi.org/project/streaming-crypto/)
48
+
49
+ ---
50
+
51
+ ## ✅ Badge Breakdown
52
+
53
+ - **CI badge** → shows GitHub Actions build/test status.
54
+ - **Crates.io badge** → shows latest published version on crates.io.
55
+ - **Docs.rs badge** → links to auto‑generated Rust documentation.
56
+ - **PyPI badge** → shows latest published version on PyPI.
57
+ - **License badge** → signals open‑source license clearly.
58
+
59
+ ---
60
+
61
+ ## Set environment python for test
62
+
63
+ 1. **Before:** PyO3 was trying to link against Python 3.13 because either a cached build or environment variable made it think our Python was 3.13.
64
+
65
+ 2. **Action:** We forced PyO3 to use Python 3.12 or current version of `pyenv` explicitly:
66
+
67
+ ```bash
68
+ export PYTHON_SYS_EXECUTABLE="$(pyenv which python3)"
69
+ export PYO3_PYTHON="$(pyenv which python3)"
70
+ export PYO3_NO_PYTHON_LINK=1
71
+
72
+ cargo clean
73
+ cargo test -p pyo3-api
74
+ ```
75
+
76
+ 3. **Result:** Cargo rebuilds PyO3 and all dependent crates from scratch. Now `cargo run --bin check_python` correctly detects Python 3.12.12 and does **not crash on missing libpython3.13.dylib**.
77
+
78
+ 4. **cargo test** will work now
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.5,<2.0"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "streaming-crypto"
7
+ version = "0.0.0" # ignored by maturin (taken from Cargo.toml)
8
+ description = "High-performance streaming encryption library powered by Rust"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Engr. Rejwanul Islam" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Rust",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: Implementation :: CPython",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent"
22
+ ]
23
+
24
+ [tool.maturin]
25
+ features = ["pyo3-api"]
26
+ strip = true
27
+ manifest-path = "streaming-crypto/Cargo.toml"
@@ -0,0 +1,4 @@
1
+ # --- DEPENDENCIES PUBLISH START ---
2
+ [dependencies]
3
+ pyo3 = { version = "0.22", optional = true, features = ["auto-initialize", "extension-module"] }
4
+ # --- DEPENDENCIES PUBLISH END ---
@@ -0,0 +1,7 @@
1
+ # --- FEATURES PUBLISH START ---
2
+ [features]
3
+ default = ["core-api"]
4
+ core-api = []
5
+ ffi-api = []
6
+ pyo3-api = ["pyo3"]
7
+ # --- FEATURES PUBLISH END ---
@@ -0,0 +1,34 @@
1
+ [package]
2
+ name = "streaming-crypto"
3
+ version = "0.1.0-alpha.12"
4
+ edition = "2021"
5
+ license = "MIT"
6
+ description = "Cryptographic library with optional FFI and Python bindings"
7
+ repository = "https://github.com/DreamzIt02/streaming-crypto"
8
+ keywords = ["crypto", "ffi", "rust", "python", "bindings"]
9
+ categories = ["cryptography", "api-bindings"]
10
+ readme = "README.md"
11
+
12
+ # --- FEATURES PUBLISH START ---
13
+ [features]
14
+ default = ["core-api"]
15
+ core-api = []
16
+ ffi-api = []
17
+ pyo3-api = ["pyo3"]
18
+ # --- FEATURES PUBLISH END ---
19
+ # --- DEPENDENCIES PUBLISH START ---
20
+ [dependencies]
21
+ pyo3 = { version = "0.22", optional = true, features = ["auto-initialize", "extension-module"] }
22
+ # --- DEPENDENCIES PUBLISH END ---# --- DEPENDENCIES COMMON START ---
23
+ rand = "0.8"
24
+ aes = "0.7"
25
+ sha2 = "0.10"
26
+ # --- DEPENDENCIES COMMON END ---
27
+
28
+ # --- DEPENDENCIES CORE START ---
29
+ core-api = { package = "streaming-crypto", version = "0.1.0-alpha.12" }
30
+ # --- DEPENDENCIES CORE END ---
31
+
32
+ [lib]
33
+ name = "streaming_crypto"
34
+ crate-type = ["rlib", "cdylib"]
@@ -0,0 +1,3 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
@@ -0,0 +1,78 @@
1
+ # streaming-crypto
2
+
3
+ [![CI](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml/badge.svg)](https://github.com/DreamzIt02/streaming-crypto/actions/workflows/ci.yml)
4
+ [![Crates.io](https://img.shields.io/crates/v/streaming-crypto.svg)](https://crates.io/crates/streaming-crypto)
5
+ [![Docs.rs](https://docs.rs/streaming-crypto/badge.svg)](https://docs.rs/streaming-crypto)
6
+ [![PyPI](https://img.shields.io/pypi/v/streaming-crypto.svg)](https://pypi.org/project/streaming-crypto/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+
9
+ A Rust cryptographic library with optional FFI and Python bindings.
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ - **Rust API** (default): Pure Rust functions.
16
+ - **FFI API**: C ABI functions for integration with C/C++ and other languages.
17
+ - **PyO3 API**: Python bindings, installable via `pip`.
18
+
19
+ ---
20
+
21
+ ## Usage
22
+
23
+ ### Rust API
24
+
25
+ ```bash
26
+ cargo add streaming-crypto
27
+ ```
28
+
29
+ ### FFI API
30
+
31
+ ```bash
32
+ cargo build --features ffi-api
33
+ ```
34
+
35
+ ### Python API
36
+
37
+ ```bash
38
+ pip install streaming-crypto
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Documentation
44
+
45
+ - [API Docs on docs.rs](https://docs.rs/streaming-crypto)
46
+ - [Crate on crates.io](https://crates.io/crates/streaming-crypto)
47
+ - [PyPI package](https://pypi.org/project/streaming-crypto/)
48
+
49
+ ---
50
+
51
+ ## ✅ Badge Breakdown
52
+
53
+ - **CI badge** → shows GitHub Actions build/test status.
54
+ - **Crates.io badge** → shows latest published version on crates.io.
55
+ - **Docs.rs badge** → links to auto‑generated Rust documentation.
56
+ - **PyPI badge** → shows latest published version on PyPI.
57
+ - **License badge** → signals open‑source license clearly.
58
+
59
+ ---
60
+
61
+ ## Set environment python for test
62
+
63
+ 1. **Before:** PyO3 was trying to link against Python 3.13 because either a cached build or environment variable made it think our Python was 3.13.
64
+
65
+ 2. **Action:** We forced PyO3 to use Python 3.12 or current version of `pyenv` explicitly:
66
+
67
+ ```bash
68
+ export PYTHON_SYS_EXECUTABLE="$(pyenv which python3)"
69
+ export PYO3_PYTHON="$(pyenv which python3)"
70
+ export PYO3_NO_PYTHON_LINK=1
71
+
72
+ cargo clean
73
+ cargo test -p pyo3-api
74
+ ```
75
+
76
+ 3. **Result:** Cargo rebuilds PyO3 and all dependent crates from scratch. Now `cargo run --bin check_python` correctly detects Python 3.12.12 and does **not crash on missing libpython3.13.dylib**.
77
+
78
+ 4. **cargo test** will work now
@@ -0,0 +1,2 @@
1
+ # core-api
2
+ Pure Rust API crate for streaming-crypto.
@@ -0,0 +1,35 @@
1
+ // ## 📝 core-api/src/lib.rs
2
+
3
+ /// Encrypts data by XORing each byte with 0xAA.
4
+ ///
5
+ /// # Examples
6
+ ///
7
+ /// ```
8
+ /// use core_api::encrypt;
9
+ ///
10
+ /// let data = vec![1, 2, 3];
11
+ /// let encrypted = encrypt(&data);
12
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
13
+ /// ```
14
+ pub fn encrypt(data: &[u8]) -> Vec<u8> {
15
+ data.iter().map(|b| b ^ 0xAA).collect()
16
+ }
17
+
18
+ #[cfg(test)]
19
+ mod tests {
20
+ use super::*;
21
+
22
+ #[test]
23
+ fn test_encrypt_core_api() {
24
+ let data = vec![1, 2, 3];
25
+ let encrypted = encrypt(&data);
26
+
27
+ // Check length matches
28
+ assert_eq!(encrypted.len(), data.len());
29
+
30
+ // Check XOR transformation
31
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
32
+ assert_eq!(encrypted[1], 2 ^ 0xAA);
33
+ assert_eq!(encrypted[2], 3 ^ 0xAA);
34
+ }
35
+ }
@@ -0,0 +1,2 @@
1
+ # ffi-api
2
+ FFI bindings crate for streaming-crypto.
@@ -0,0 +1,53 @@
1
+ // ## 📝 ffi-api/src/lib.rs
2
+
3
+ // Import the core Rust implementation
4
+ use core_api::encrypt as core_encrypt;
5
+
6
+ /// FFI wrapper for encryption.
7
+ ///
8
+ /// # Safety
9
+ /// Returns a raw pointer. Caller must manage memory.
10
+
11
+ /// FFI wrapper for encryption.
12
+ ///
13
+ /// # Safety
14
+ /// This function returns a raw pointer. The caller must manage memory.
15
+ ///
16
+ /// # Examples
17
+ /// ```
18
+ /// use std::slice;
19
+ /// use ffi_api::encrypt;
20
+ ///
21
+ /// let data = vec![1, 2, 3];
22
+ /// let ptr = encrypt(data.as_ptr(), data.len());
23
+ /// let encrypted = unsafe { slice::from_raw_parts(ptr, data.len()) };
24
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
25
+ /// ```
26
+ #[no_mangle]
27
+ pub extern "C" fn encrypt(data: *const u8, len: usize) -> *mut u8 {
28
+ let slice = unsafe { std::slice::from_raw_parts(data, len) };
29
+ let encrypted: Vec<u8> = core_encrypt(slice);
30
+ let mut boxed = encrypted.into_boxed_slice();
31
+ let ptr = boxed.as_mut_ptr();
32
+ std::mem::forget(boxed);
33
+ ptr
34
+ }
35
+
36
+ #[cfg(test)]
37
+ mod tests {
38
+ use super::*;
39
+ use std::slice;
40
+
41
+ #[test]
42
+ fn test_encrypt_ffi_api() {
43
+ let data = vec![1, 2, 3];
44
+ let ptr = encrypt(data.as_ptr(), data.len());
45
+
46
+ // Reconstruct slice from raw pointer
47
+ let encrypted = unsafe { slice::from_raw_parts(ptr, data.len()) };
48
+
49
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
50
+ assert_eq!(encrypted[1], 2 ^ 0xAA);
51
+ assert_eq!(encrypted[2], 3 ^ 0xAA);
52
+ }
53
+ }
@@ -0,0 +1,71 @@
1
+ // ## 📝 streaming-crypto/src/lib.rs
2
+
3
+ // --- MODULES PUBLISH START ---
4
+ #[cfg(feature = "core-api")]
5
+ pub mod core_api;
6
+
7
+ #[cfg(feature = "ffi-api")]
8
+ pub mod ffi_api;
9
+
10
+ #[cfg(feature = "pyo3-api")]
11
+ pub mod pyo3_api;
12
+ // --- MODULES PUBLISH END ---
13
+
14
+ /// Encrypts data by XORing each byte with 0xAA.
15
+ ///
16
+ /// # Examples
17
+ ///
18
+ /// ```
19
+ /// use core_api::encrypt;
20
+ ///
21
+ /// let data = vec![1, 2, 3];
22
+ /// let encrypted = encrypt(&data);
23
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
24
+ #[cfg(feature = "core-api")]
25
+ pub use core_api::encrypt; // re-export the FFI wrapper
26
+
27
+ /// FFI wrapper for encryption.
28
+ ///
29
+ /// # Safety
30
+ /// Returns a raw pointer. Caller must manage memory.
31
+
32
+ /// FFI wrapper for encryption.
33
+ ///
34
+ /// # Safety
35
+ /// This function returns a raw pointer. The caller must manage memory.
36
+ ///
37
+ /// # Examples
38
+ ///
39
+ /// ```
40
+ /// use std::slice;
41
+ /// use ffi_api::encrypt;
42
+ ///
43
+ /// let data = vec![1, 2, 3];
44
+ /// let ptr = encrypt(data.as_ptr(), data.len());
45
+ /// let encrypted = unsafe { slice::from_raw_parts(ptr, data.len()) };
46
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
47
+ #[cfg(feature = "ffi-api")]
48
+ pub use ffi_api::encrypt; // re-export the FFI wrapper
49
+
50
+ /// # Examples
51
+ ///
52
+ /// ```
53
+ /// use pyo3::prelude::*;
54
+ /// use pyo3_api::encrypt;
55
+ /// use pyo3::types::PyBytes;
56
+ ///
57
+ /// Python::with_gil(|py| {
58
+ /// let data = PyBytes::new_bound(py, &[1, 2, 3]);
59
+ ///
60
+ /// let encrypted = encrypt(py, &data).unwrap();
61
+ ///
62
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
63
+ /// assert_eq!(encrypted[1], 2 ^ 0xAA);
64
+ /// assert_eq!(encrypted[2], 3 ^ 0xAA);
65
+ /// });
66
+ /// ```
67
+ #[cfg(feature = "pyo3-api")]
68
+ pub use pyo3_api::encrypt; // re-export the PyO3 wrapper
69
+
70
+ #[cfg(feature = "pyo3-api")]
71
+ pub use pyo3_api::streaming_crypto; // re-export the #[pymodule]
@@ -0,0 +1,3 @@
1
+ # pyo3-api
2
+
3
+ Python bindings crate for streaming-crypto using PyO3.
@@ -0,0 +1,64 @@
1
+ // ## 📝 pyo3-api/src/lib.rs
2
+
3
+ use pyo3::prelude::*;
4
+ use pyo3::types::PyBytes;
5
+
6
+ // Import the core Rust implementation from core-api
7
+ use core_api::encrypt as core_encrypt;
8
+
9
+ /// # Examples
10
+ ///
11
+ /// ```rust,no_run
12
+ /// use pyo3::prelude::*;
13
+ /// use pyo3_api::encrypt;
14
+ /// use pyo3::types::PyBytes;
15
+ ///
16
+ /// Python::with_gil(|py| {
17
+ /// let data = PyBytes::new_bound(py, &[1, 2, 3]);
18
+ ///
19
+ /// let encrypted = encrypt(py, &data).unwrap();
20
+ ///
21
+ /// assert_eq!(encrypted[0], 1 ^ 0xAA);
22
+ /// assert_eq!(encrypted[1], 2 ^ 0xAA);
23
+ /// assert_eq!(encrypted[2], 3 ^ 0xAA);
24
+ /// });
25
+ /// ```
26
+ #[pyfunction]
27
+ pub fn encrypt<'py>(py: Python<'py>, data: &Bound<'py, PyBytes>,) -> PyResult<Bound<'py, PyBytes>> {
28
+ // ✅ Extract pure Rust slice while GIL is held
29
+ let input: &[u8] = data.as_bytes();
30
+
31
+ // ✅ Now closure only captures &[u8] (which is Send)
32
+ let encrypted: Vec<u8> = py.allow_threads(|| { core_encrypt(input) });
33
+
34
+ Ok(PyBytes::new_bound(py, &encrypted))
35
+ }
36
+
37
+ #[pymodule]
38
+ pub fn streaming_crypto(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
39
+
40
+ // Register public api
41
+ m.add_function(wrap_pyfunction!(encrypt, m)?)?;
42
+
43
+ Ok(())
44
+ }
45
+
46
+ #[cfg(test)]
47
+ mod tests {
48
+ use super::*;
49
+ use pyo3::types::PyBytes;
50
+
51
+ #[test]
52
+ fn test_encrypt_py_api() {
53
+ Python::with_gil(|py| {
54
+ let data = PyBytes::new_bound(py, &[1, 2, 3]);
55
+
56
+ // Pass raw slice
57
+ let encrypted = encrypt(py, &data).unwrap();
58
+
59
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
60
+ assert_eq!(encrypted[1], 2 ^ 0xAA);
61
+ assert_eq!(encrypted[2], 3 ^ 0xAA);
62
+ });
63
+ }
64
+ }
@@ -0,0 +1,9 @@
1
+ #[cfg(feature = "core-api")]
2
+ #[test]
3
+ fn test_encrypt_core_wrapper() {
4
+ let data = vec![1, 2, 3];
5
+ let encrypted = streaming_crypto::encrypt(&data);
6
+ assert_eq!(encrypted.len(), 3);
7
+ // sanity check: XOR with 0xAA
8
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
9
+ }
@@ -0,0 +1,16 @@
1
+
2
+ #[cfg(feature = "ffi-api")]
3
+ #[test]
4
+ fn test_encrypt_ffi_wrapper() {
5
+ use std::slice;
6
+
7
+ let data = vec![1, 2, 3];
8
+ let ptr = streaming_crypto::encrypt(data.as_ptr(), data.len());
9
+
10
+ // reconstruct slice from raw pointer
11
+ let encrypted = unsafe { slice::from_raw_parts(ptr, data.len()) };
12
+
13
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
14
+ assert_eq!(encrypted[1], 2 ^ 0xAA);
15
+ assert_eq!(encrypted[2], 3 ^ 0xAA);
16
+ }
@@ -0,0 +1,17 @@
1
+ #[cfg(feature = "pyo3-api")]
2
+ #[test]
3
+ fn test_encrypt_py_wrapper() {
4
+ use pyo3::Python;
5
+ use pyo3::types::PyBytes;
6
+
7
+ Python::with_gil(|py| {
8
+ let data = PyBytes::new_bound(py, &[1, 2, 3]);
9
+
10
+ // Pass raw slice
11
+ let encrypted = streaming_crypto::encrypt(py, &data).unwrap();
12
+
13
+ assert_eq!(encrypted[0], 1 ^ 0xAA);
14
+ assert_eq!(encrypted[1], 2 ^ 0xAA);
15
+ assert_eq!(encrypted[2], 3 ^ 0xAA);
16
+ });
17
+ }