stegaQR 0.1.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.
- stegaqr-0.1.0/LICENSE +21 -0
- stegaqr-0.1.0/PKG-INFO +157 -0
- stegaqr-0.1.0/README.md +114 -0
- stegaqr-0.1.0/pyproject.toml +81 -0
- stegaqr-0.1.0/setup.cfg +4 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/PKG-INFO +157 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/SOURCES.txt +41 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/dependency_links.txt +1 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/entry_points.txt +2 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/requires.txt +20 -0
- stegaqr-0.1.0/src/stegaQR.egg-info/top_level.txt +1 -0
- stegaqr-0.1.0/src/stegaqr/__init__.py +22 -0
- stegaqr-0.1.0/src/stegaqr/analysis/__init__.py +1 -0
- stegaqr-0.1.0/src/stegaqr/assets/stegaqr_default.pt +0 -0
- stegaqr-0.1.0/src/stegaqr/cli.py +101 -0
- stegaqr-0.1.0/src/stegaqr/coding.py +189 -0
- stegaqr-0.1.0/src/stegaqr/core.py +208 -0
- stegaqr-0.1.0/src/stegaqr/data/__init__.py +1 -0
- stegaqr-0.1.0/src/stegaqr/data/synthetic.py +172 -0
- stegaqr-0.1.0/src/stegaqr/evaluation.py +236 -0
- stegaqr-0.1.0/src/stegaqr/models/__init__.py +9 -0
- stegaqr-0.1.0/src/stegaqr/models/classical.py +111 -0
- stegaqr-0.1.0/src/stegaqr/models/decoder.py +206 -0
- stegaqr-0.1.0/src/stegaqr/models/distortion.py +166 -0
- stegaqr-0.1.0/src/stegaqr/models/encoder.py +243 -0
- stegaqr-0.1.0/src/stegaqr/models/losses.py +244 -0
- stegaqr-0.1.0/src/stegaqr/realistic_distortion.py +82 -0
- stegaqr-0.1.0/src/stegaqr/training.py +423 -0
- stegaqr-0.1.0/src/stegaqr/utils/__init__.py +1 -0
- stegaqr-0.1.0/src/stegaqr/utils/metrics.py +186 -0
- stegaqr-0.1.0/src/stegaqr/utils/qr_utils.py +212 -0
- stegaqr-0.1.0/src/stegaqr/utils/seed.py +73 -0
- stegaqr-0.1.0/tests/test_classical.py +42 -0
- stegaqr-0.1.0/tests/test_coding.py +90 -0
- stegaqr-0.1.0/tests/test_core.py +74 -0
- stegaqr-0.1.0/tests/test_data.py +91 -0
- stegaqr-0.1.0/tests/test_losses.py +112 -0
- stegaqr-0.1.0/tests/test_mask_aware_hybrid.py +49 -0
- stegaqr-0.1.0/tests/test_metrics.py +79 -0
- stegaqr-0.1.0/tests/test_models.py +193 -0
- stegaqr-0.1.0/tests/test_qr_utils.py +131 -0
- stegaqr-0.1.0/tests/test_realistic_distortion.py +50 -0
- stegaqr-0.1.0/tests/test_training.py +66 -0
stegaqr-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Muntaser Syed
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
stegaqr-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stegaQR
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Neural steganographic data embedding in QR codes with switchable channel modes
|
|
5
|
+
Author-email: Muntaser Syed <jemsbhai@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jemsbhai/stegaQR
|
|
8
|
+
Project-URL: Repository, https://github.com/jemsbhai/stegaQR
|
|
9
|
+
Project-URL: Issues, https://github.com/jemsbhai/stegaQR/issues
|
|
10
|
+
Keywords: QR code,steganography,watermarking,error correction,deep learning
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Security :: Cryptography
|
|
21
|
+
Requires-Python: <3.13,>=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: pillow>=9.0
|
|
26
|
+
Requires-Dist: opencv-python>=4.0
|
|
27
|
+
Requires-Dist: qrcode[pil]>=7.0
|
|
28
|
+
Requires-Dist: scipy>=1.11
|
|
29
|
+
Requires-Dist: torch>=2.0
|
|
30
|
+
Requires-Dist: pyzbar>=0.1.9
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
37
|
+
Provides-Extra: analysis
|
|
38
|
+
Requires-Dist: matplotlib>=3.7; extra == "analysis"
|
|
39
|
+
Requires-Dist: seaborn>=0.12; extra == "analysis"
|
|
40
|
+
Requires-Dist: pandas>=2.0; extra == "analysis"
|
|
41
|
+
Requires-Dist: scikit-learn>=1.3; extra == "analysis"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# StegaQR
|
|
45
|
+
|
|
46
|
+
StegaQR embeds a small private payload inside a QR code while preserving the public
|
|
47
|
+
payload for ordinary QR readers. A trained neural decoder recovers the private data.
|
|
48
|
+
|
|
49
|
+
The package includes a trained hybrid model, repetition and Hamming error correction,
|
|
50
|
+
a command line interface, and a Python API. The bundled model carries 100 coded bits.
|
|
51
|
+
With the default repetition code, it carries up to 4 hidden bytes.
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```powershell
|
|
56
|
+
pip install stegaQR
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
StegaQR supports Python 3.10 through 3.12. PyTorch is installed as a required
|
|
60
|
+
dependency. Public QR decoding uses `pyzbar`. Some Linux and macOS environments also
|
|
61
|
+
need the native ZBar library supplied by the operating system.
|
|
62
|
+
|
|
63
|
+
## Command line
|
|
64
|
+
|
|
65
|
+
Inspect the bundled model:
|
|
66
|
+
|
|
67
|
+
```powershell
|
|
68
|
+
stegaqr info
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Create a QR code with a public URL and a private four byte identifier:
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
stegaqr encode --public "https://example.com/p" --message "ID42" --out stego.png
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Recover both payloads:
|
|
78
|
+
|
|
79
|
+
```powershell
|
|
80
|
+
stegaqr decode --image stego.png
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The generated image includes a quiet zone and nearest neighbor upscaling for reliable
|
|
84
|
+
scanning. Use `--model PATH` to select a different trained checkpoint.
|
|
85
|
+
|
|
86
|
+
## Python API
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from stegaqr import decode_hidden, encode_hidden
|
|
90
|
+
|
|
91
|
+
image = encode_hidden("https://example.com", b"ID42", device="cpu")
|
|
92
|
+
public, hidden, metadata = decode_hidden(image, device="cpu")
|
|
93
|
+
|
|
94
|
+
assert public == "https://example.com"
|
|
95
|
+
assert hidden.rstrip(b"\x00") == b"ID42"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
CUDA is used when requested and available. Otherwise the package falls back to CPU.
|
|
99
|
+
|
|
100
|
+
## Embedding modes
|
|
101
|
+
|
|
102
|
+
The research implementation supports three trained architectures:
|
|
103
|
+
|
|
104
|
+
| Mode | Design | Purpose |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| Segregated | One encoder and decoder per color channel | Channel fault isolation |
|
|
107
|
+
| Cross-channel | Joint RGB encoder and decoder | Flexible signal placement |
|
|
108
|
+
| Hybrid | Joint RGB model with a QR structure mask | Protects finder and control modules |
|
|
109
|
+
|
|
110
|
+
The bundled model uses the hybrid architecture with a mask-aware spatial bit grid and
|
|
111
|
+
no color calibration branch.
|
|
112
|
+
|
|
113
|
+
## Reported results
|
|
114
|
+
|
|
115
|
+
The saved experiment matrix contains five seed comparisons for the three modes,
|
|
116
|
+
capacity studies from 25 to 200 coded bits, error correction comparisons, an
|
|
117
|
+
architecture ablation, and a classical baseline. The physical pilot recovered the
|
|
118
|
+
public and private payloads from all 10 screen to phone photographs after QR detection
|
|
119
|
+
and perspective rectification.
|
|
120
|
+
|
|
121
|
+
The robust operating point has a visible color tint. It should be described as robust
|
|
122
|
+
data embedding, not invisible steganography. The high PSNR operating point is visually
|
|
123
|
+
subtle but was not validated for physical capture.
|
|
124
|
+
|
|
125
|
+
See [`experiments/full/RESULTS.md`](experiments/full/RESULTS.md),
|
|
126
|
+
[`LOGBOOK.md`](LOGBOOK.md), and [`paper/main.pdf`](paper/main.pdf) for the recorded
|
|
127
|
+
evidence and limitations.
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
```powershell
|
|
132
|
+
git clone https://github.com/jemsbhai/stegaQR.git
|
|
133
|
+
cd stegaQR
|
|
134
|
+
pip install -e ".[dev,analysis]"
|
|
135
|
+
pytest
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Train and evaluate a checkpoint:
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
python scripts/train.py --mode hybrid --mask-aware --no-calibration `
|
|
142
|
+
--output-dir experiments/run1
|
|
143
|
+
python scripts/evaluate.py --checkpoint experiments/run1/best_model.pt
|
|
144
|
+
python scripts/evaluate_real.py --checkpoint experiments/run1/best_model.pt
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The complete experiment matrix is resumable:
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
python scripts/run_experiments.py
|
|
151
|
+
python scripts/aggregate_results.py
|
|
152
|
+
python scripts/generate_figures.py
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
stegaqr-0.1.0/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# StegaQR
|
|
2
|
+
|
|
3
|
+
StegaQR embeds a small private payload inside a QR code while preserving the public
|
|
4
|
+
payload for ordinary QR readers. A trained neural decoder recovers the private data.
|
|
5
|
+
|
|
6
|
+
The package includes a trained hybrid model, repetition and Hamming error correction,
|
|
7
|
+
a command line interface, and a Python API. The bundled model carries 100 coded bits.
|
|
8
|
+
With the default repetition code, it carries up to 4 hidden bytes.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
pip install stegaQR
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
StegaQR supports Python 3.10 through 3.12. PyTorch is installed as a required
|
|
17
|
+
dependency. Public QR decoding uses `pyzbar`. Some Linux and macOS environments also
|
|
18
|
+
need the native ZBar library supplied by the operating system.
|
|
19
|
+
|
|
20
|
+
## Command line
|
|
21
|
+
|
|
22
|
+
Inspect the bundled model:
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
stegaqr info
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Create a QR code with a public URL and a private four byte identifier:
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
stegaqr encode --public "https://example.com/p" --message "ID42" --out stego.png
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Recover both payloads:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
stegaqr decode --image stego.png
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The generated image includes a quiet zone and nearest neighbor upscaling for reliable
|
|
41
|
+
scanning. Use `--model PATH` to select a different trained checkpoint.
|
|
42
|
+
|
|
43
|
+
## Python API
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from stegaqr import decode_hidden, encode_hidden
|
|
47
|
+
|
|
48
|
+
image = encode_hidden("https://example.com", b"ID42", device="cpu")
|
|
49
|
+
public, hidden, metadata = decode_hidden(image, device="cpu")
|
|
50
|
+
|
|
51
|
+
assert public == "https://example.com"
|
|
52
|
+
assert hidden.rstrip(b"\x00") == b"ID42"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
CUDA is used when requested and available. Otherwise the package falls back to CPU.
|
|
56
|
+
|
|
57
|
+
## Embedding modes
|
|
58
|
+
|
|
59
|
+
The research implementation supports three trained architectures:
|
|
60
|
+
|
|
61
|
+
| Mode | Design | Purpose |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| Segregated | One encoder and decoder per color channel | Channel fault isolation |
|
|
64
|
+
| Cross-channel | Joint RGB encoder and decoder | Flexible signal placement |
|
|
65
|
+
| Hybrid | Joint RGB model with a QR structure mask | Protects finder and control modules |
|
|
66
|
+
|
|
67
|
+
The bundled model uses the hybrid architecture with a mask-aware spatial bit grid and
|
|
68
|
+
no color calibration branch.
|
|
69
|
+
|
|
70
|
+
## Reported results
|
|
71
|
+
|
|
72
|
+
The saved experiment matrix contains five seed comparisons for the three modes,
|
|
73
|
+
capacity studies from 25 to 200 coded bits, error correction comparisons, an
|
|
74
|
+
architecture ablation, and a classical baseline. The physical pilot recovered the
|
|
75
|
+
public and private payloads from all 10 screen to phone photographs after QR detection
|
|
76
|
+
and perspective rectification.
|
|
77
|
+
|
|
78
|
+
The robust operating point has a visible color tint. It should be described as robust
|
|
79
|
+
data embedding, not invisible steganography. The high PSNR operating point is visually
|
|
80
|
+
subtle but was not validated for physical capture.
|
|
81
|
+
|
|
82
|
+
See [`experiments/full/RESULTS.md`](experiments/full/RESULTS.md),
|
|
83
|
+
[`LOGBOOK.md`](LOGBOOK.md), and [`paper/main.pdf`](paper/main.pdf) for the recorded
|
|
84
|
+
evidence and limitations.
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
```powershell
|
|
89
|
+
git clone https://github.com/jemsbhai/stegaQR.git
|
|
90
|
+
cd stegaQR
|
|
91
|
+
pip install -e ".[dev,analysis]"
|
|
92
|
+
pytest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Train and evaluate a checkpoint:
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
python scripts/train.py --mode hybrid --mask-aware --no-calibration `
|
|
99
|
+
--output-dir experiments/run1
|
|
100
|
+
python scripts/evaluate.py --checkpoint experiments/run1/best_model.pt
|
|
101
|
+
python scripts/evaluate_real.py --checkpoint experiments/run1/best_model.pt
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The complete experiment matrix is resumable:
|
|
105
|
+
|
|
106
|
+
```powershell
|
|
107
|
+
python scripts/run_experiments.py
|
|
108
|
+
python scripts/aggregate_results.py
|
|
109
|
+
python scripts/generate_figures.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stegaQR"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Neural steganographic data embedding in QR codes with switchable channel modes"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{name = "Muntaser Syed", email = "jemsbhai@gmail.com"}]
|
|
13
|
+
requires-python = ">=3.10,<3.13"
|
|
14
|
+
keywords = ["QR code", "steganography", "watermarking", "error correction", "deep learning"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
"Topic :: Security :: Cryptography",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"numpy>=1.24",
|
|
29
|
+
"pillow>=9.0",
|
|
30
|
+
"opencv-python>=4.0",
|
|
31
|
+
"qrcode[pil]>=7.0",
|
|
32
|
+
"scipy>=1.11",
|
|
33
|
+
"torch>=2.0",
|
|
34
|
+
"pyzbar>=0.1.9",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/jemsbhai/stegaQR"
|
|
39
|
+
Repository = "https://github.com/jemsbhai/stegaQR"
|
|
40
|
+
Issues = "https://github.com/jemsbhai/stegaQR/issues"
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
dev = [
|
|
44
|
+
"build>=1.2",
|
|
45
|
+
"pytest>=7.0",
|
|
46
|
+
"pytest-cov>=4.0",
|
|
47
|
+
"mypy>=1.0",
|
|
48
|
+
"twine>=5.0",
|
|
49
|
+
]
|
|
50
|
+
analysis = [
|
|
51
|
+
"matplotlib>=3.7",
|
|
52
|
+
"seaborn>=0.12",
|
|
53
|
+
"pandas>=2.0",
|
|
54
|
+
"scikit-learn>=1.3",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
stegaqr = "stegaqr.cli:main"
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.packages.find]
|
|
61
|
+
where = ["src"]
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.package-data]
|
|
64
|
+
stegaqr = ["assets/*.pt"]
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
testpaths = ["tests"]
|
|
68
|
+
markers = [
|
|
69
|
+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
70
|
+
"gpu: marks tests requiring GPU",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.coverage.run]
|
|
74
|
+
source = ["src/stegaqr"]
|
|
75
|
+
branch = true
|
|
76
|
+
|
|
77
|
+
[tool.mypy]
|
|
78
|
+
python_version = "3.10"
|
|
79
|
+
warn_return_any = true
|
|
80
|
+
warn_unused_configs = true
|
|
81
|
+
ignore_missing_imports = true
|
stegaqr-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stegaQR
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Neural steganographic data embedding in QR codes with switchable channel modes
|
|
5
|
+
Author-email: Muntaser Syed <jemsbhai@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jemsbhai/stegaQR
|
|
8
|
+
Project-URL: Repository, https://github.com/jemsbhai/stegaQR
|
|
9
|
+
Project-URL: Issues, https://github.com/jemsbhai/stegaQR/issues
|
|
10
|
+
Keywords: QR code,steganography,watermarking,error correction,deep learning
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Security :: Cryptography
|
|
21
|
+
Requires-Python: <3.13,>=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: pillow>=9.0
|
|
26
|
+
Requires-Dist: opencv-python>=4.0
|
|
27
|
+
Requires-Dist: qrcode[pil]>=7.0
|
|
28
|
+
Requires-Dist: scipy>=1.11
|
|
29
|
+
Requires-Dist: torch>=2.0
|
|
30
|
+
Requires-Dist: pyzbar>=0.1.9
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
37
|
+
Provides-Extra: analysis
|
|
38
|
+
Requires-Dist: matplotlib>=3.7; extra == "analysis"
|
|
39
|
+
Requires-Dist: seaborn>=0.12; extra == "analysis"
|
|
40
|
+
Requires-Dist: pandas>=2.0; extra == "analysis"
|
|
41
|
+
Requires-Dist: scikit-learn>=1.3; extra == "analysis"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# StegaQR
|
|
45
|
+
|
|
46
|
+
StegaQR embeds a small private payload inside a QR code while preserving the public
|
|
47
|
+
payload for ordinary QR readers. A trained neural decoder recovers the private data.
|
|
48
|
+
|
|
49
|
+
The package includes a trained hybrid model, repetition and Hamming error correction,
|
|
50
|
+
a command line interface, and a Python API. The bundled model carries 100 coded bits.
|
|
51
|
+
With the default repetition code, it carries up to 4 hidden bytes.
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```powershell
|
|
56
|
+
pip install stegaQR
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
StegaQR supports Python 3.10 through 3.12. PyTorch is installed as a required
|
|
60
|
+
dependency. Public QR decoding uses `pyzbar`. Some Linux and macOS environments also
|
|
61
|
+
need the native ZBar library supplied by the operating system.
|
|
62
|
+
|
|
63
|
+
## Command line
|
|
64
|
+
|
|
65
|
+
Inspect the bundled model:
|
|
66
|
+
|
|
67
|
+
```powershell
|
|
68
|
+
stegaqr info
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Create a QR code with a public URL and a private four byte identifier:
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
stegaqr encode --public "https://example.com/p" --message "ID42" --out stego.png
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Recover both payloads:
|
|
78
|
+
|
|
79
|
+
```powershell
|
|
80
|
+
stegaqr decode --image stego.png
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The generated image includes a quiet zone and nearest neighbor upscaling for reliable
|
|
84
|
+
scanning. Use `--model PATH` to select a different trained checkpoint.
|
|
85
|
+
|
|
86
|
+
## Python API
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from stegaqr import decode_hidden, encode_hidden
|
|
90
|
+
|
|
91
|
+
image = encode_hidden("https://example.com", b"ID42", device="cpu")
|
|
92
|
+
public, hidden, metadata = decode_hidden(image, device="cpu")
|
|
93
|
+
|
|
94
|
+
assert public == "https://example.com"
|
|
95
|
+
assert hidden.rstrip(b"\x00") == b"ID42"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
CUDA is used when requested and available. Otherwise the package falls back to CPU.
|
|
99
|
+
|
|
100
|
+
## Embedding modes
|
|
101
|
+
|
|
102
|
+
The research implementation supports three trained architectures:
|
|
103
|
+
|
|
104
|
+
| Mode | Design | Purpose |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| Segregated | One encoder and decoder per color channel | Channel fault isolation |
|
|
107
|
+
| Cross-channel | Joint RGB encoder and decoder | Flexible signal placement |
|
|
108
|
+
| Hybrid | Joint RGB model with a QR structure mask | Protects finder and control modules |
|
|
109
|
+
|
|
110
|
+
The bundled model uses the hybrid architecture with a mask-aware spatial bit grid and
|
|
111
|
+
no color calibration branch.
|
|
112
|
+
|
|
113
|
+
## Reported results
|
|
114
|
+
|
|
115
|
+
The saved experiment matrix contains five seed comparisons for the three modes,
|
|
116
|
+
capacity studies from 25 to 200 coded bits, error correction comparisons, an
|
|
117
|
+
architecture ablation, and a classical baseline. The physical pilot recovered the
|
|
118
|
+
public and private payloads from all 10 screen to phone photographs after QR detection
|
|
119
|
+
and perspective rectification.
|
|
120
|
+
|
|
121
|
+
The robust operating point has a visible color tint. It should be described as robust
|
|
122
|
+
data embedding, not invisible steganography. The high PSNR operating point is visually
|
|
123
|
+
subtle but was not validated for physical capture.
|
|
124
|
+
|
|
125
|
+
See [`experiments/full/RESULTS.md`](experiments/full/RESULTS.md),
|
|
126
|
+
[`LOGBOOK.md`](LOGBOOK.md), and [`paper/main.pdf`](paper/main.pdf) for the recorded
|
|
127
|
+
evidence and limitations.
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
```powershell
|
|
132
|
+
git clone https://github.com/jemsbhai/stegaQR.git
|
|
133
|
+
cd stegaQR
|
|
134
|
+
pip install -e ".[dev,analysis]"
|
|
135
|
+
pytest
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Train and evaluate a checkpoint:
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
python scripts/train.py --mode hybrid --mask-aware --no-calibration `
|
|
142
|
+
--output-dir experiments/run1
|
|
143
|
+
python scripts/evaluate.py --checkpoint experiments/run1/best_model.pt
|
|
144
|
+
python scripts/evaluate_real.py --checkpoint experiments/run1/best_model.pt
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The complete experiment matrix is resumable:
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
python scripts/run_experiments.py
|
|
151
|
+
python scripts/aggregate_results.py
|
|
152
|
+
python scripts/generate_figures.py
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/stegaQR.egg-info/PKG-INFO
|
|
5
|
+
src/stegaQR.egg-info/SOURCES.txt
|
|
6
|
+
src/stegaQR.egg-info/dependency_links.txt
|
|
7
|
+
src/stegaQR.egg-info/entry_points.txt
|
|
8
|
+
src/stegaQR.egg-info/requires.txt
|
|
9
|
+
src/stegaQR.egg-info/top_level.txt
|
|
10
|
+
src/stegaqr/__init__.py
|
|
11
|
+
src/stegaqr/cli.py
|
|
12
|
+
src/stegaqr/coding.py
|
|
13
|
+
src/stegaqr/core.py
|
|
14
|
+
src/stegaqr/evaluation.py
|
|
15
|
+
src/stegaqr/realistic_distortion.py
|
|
16
|
+
src/stegaqr/training.py
|
|
17
|
+
src/stegaqr/analysis/__init__.py
|
|
18
|
+
src/stegaqr/assets/stegaqr_default.pt
|
|
19
|
+
src/stegaqr/data/__init__.py
|
|
20
|
+
src/stegaqr/data/synthetic.py
|
|
21
|
+
src/stegaqr/models/__init__.py
|
|
22
|
+
src/stegaqr/models/classical.py
|
|
23
|
+
src/stegaqr/models/decoder.py
|
|
24
|
+
src/stegaqr/models/distortion.py
|
|
25
|
+
src/stegaqr/models/encoder.py
|
|
26
|
+
src/stegaqr/models/losses.py
|
|
27
|
+
src/stegaqr/utils/__init__.py
|
|
28
|
+
src/stegaqr/utils/metrics.py
|
|
29
|
+
src/stegaqr/utils/qr_utils.py
|
|
30
|
+
src/stegaqr/utils/seed.py
|
|
31
|
+
tests/test_classical.py
|
|
32
|
+
tests/test_coding.py
|
|
33
|
+
tests/test_core.py
|
|
34
|
+
tests/test_data.py
|
|
35
|
+
tests/test_losses.py
|
|
36
|
+
tests/test_mask_aware_hybrid.py
|
|
37
|
+
tests/test_metrics.py
|
|
38
|
+
tests/test_models.py
|
|
39
|
+
tests/test_qr_utils.py
|
|
40
|
+
tests/test_realistic_distortion.py
|
|
41
|
+
tests/test_training.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
numpy>=1.24
|
|
2
|
+
pillow>=9.0
|
|
3
|
+
opencv-python>=4.0
|
|
4
|
+
qrcode[pil]>=7.0
|
|
5
|
+
scipy>=1.11
|
|
6
|
+
torch>=2.0
|
|
7
|
+
pyzbar>=0.1.9
|
|
8
|
+
|
|
9
|
+
[analysis]
|
|
10
|
+
matplotlib>=3.7
|
|
11
|
+
seaborn>=0.12
|
|
12
|
+
pandas>=2.0
|
|
13
|
+
scikit-learn>=1.3
|
|
14
|
+
|
|
15
|
+
[dev]
|
|
16
|
+
build>=1.2
|
|
17
|
+
pytest>=7.0
|
|
18
|
+
pytest-cov>=4.0
|
|
19
|
+
mypy>=1.0
|
|
20
|
+
twine>=5.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stegaqr
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""StegaQR: Neural steganographic data embedding in QR codes."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from stegaqr.core import (
|
|
6
|
+
StegaQREncoder,
|
|
7
|
+
StegaQRDecoder,
|
|
8
|
+
encode_hidden,
|
|
9
|
+
decode_hidden,
|
|
10
|
+
default_model_path,
|
|
11
|
+
StegoMode,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"StegaQREncoder",
|
|
16
|
+
"StegaQRDecoder",
|
|
17
|
+
"encode_hidden",
|
|
18
|
+
"decode_hidden",
|
|
19
|
+
"default_model_path",
|
|
20
|
+
"StegoMode",
|
|
21
|
+
"__version__",
|
|
22
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Statistical analysis scripts for experiment results."""
|
|
Binary file
|