jucrypt 0.3.2__tar.gz → 0.4.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.
Files changed (30) hide show
  1. jucrypt-0.4.0/PKG-INFO +140 -0
  2. jucrypt-0.4.0/README.md +110 -0
  3. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/__init__.py +3 -2
  4. jucrypt-0.4.0/jucrypt/greatwall.py +546 -0
  5. jucrypt-0.4.0/jucrypt/greatwallext.c +530 -0
  6. jucrypt-0.4.0/jucrypt/story2.py +612 -0
  7. jucrypt-0.4.0/jucrypt/story2_128ext.c +458 -0
  8. jucrypt-0.4.0/jucrypt/story2_opt.py +678 -0
  9. jucrypt-0.4.0/jucrypt/story_blake.py +550 -0
  10. jucrypt-0.4.0/jucrypt.egg-info/PKG-INFO +140 -0
  11. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt.egg-info/SOURCES.txt +6 -0
  12. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt.egg-info/requires.txt +1 -0
  13. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt.egg-info/top_level.txt +1 -0
  14. {jucrypt-0.3.2 → jucrypt-0.4.0}/pyproject.toml +3 -3
  15. {jucrypt-0.3.2 → jucrypt-0.4.0}/setup.py +6 -0
  16. {jucrypt-0.3.2 → jucrypt-0.4.0}/tests/test_story.py +0 -9
  17. jucrypt-0.3.2/PKG-INFO +0 -390
  18. jucrypt-0.3.2/README.md +0 -361
  19. jucrypt-0.3.2/jucrypt.egg-info/PKG-INFO +0 -390
  20. {jucrypt-0.3.2 → jucrypt-0.4.0}/LICENSE +0 -0
  21. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/default_sboxes.py +0 -0
  22. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/story.py +0 -0
  23. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/story128ext.c +0 -0
  24. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/story256.py +0 -0
  25. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/story256c.py +0 -0
  26. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/story256ext.c +0 -0
  27. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt/storyc.py +0 -0
  28. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt.egg-info/dependency_links.txt +0 -0
  29. {jucrypt-0.3.2 → jucrypt-0.4.0}/jucrypt.egg-info/entry_points.txt +0 -0
  30. {jucrypt-0.3.2 → jucrypt-0.4.0}/setup.cfg +0 -0
jucrypt-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: jucrypt
3
+ Version: 0.4.0
4
+ Summary: The parent dir of STORY, MUCRYPT, RESIMAGE and many more...
5
+ Author-email: "I. Nabil" <w3nabil@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/w3nabil/jucrypt
8
+ Project-URL: Repository, https://github.com/w3nabil/jucrypt
9
+ Project-URL: Issues, https://github.com/w3nabil/jucrypt/issues
10
+ Project-URL: Changelog, https://github.com/w3nabil/jucrypt/changelog.md
11
+ Keywords: cryptography,symmetric encryption,educational crypto,experimental cipher,story-based key derivation
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Education
15
+ Classifier: Topic :: Security :: Cryptography
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Operating System :: OS Independent
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: experiment
25
+ Requires-Dist: numpy>=1.23; extra == "experiment"
26
+ Requires-Dist: scipy>=1.17.1; extra == "experiment"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Ju's Story (STORY)
32
+
33
+ > **Your story is your key.**
34
+ > A story-key driven Substitution-Permutation Network cipher.
35
+
36
+ > **Pre-review research cipher.** No external cryptanalysis or formal peer review has been conducted yet. We are actively seeking feedback from the research community. See [Current Limitations and Open Issues](#current-limitations-and-open-issues) before use.
37
+
38
+ [![Python](https://img.shields.io/badge/Python-3.9%2B-blue?logo=python)](https://www.python.org/)
39
+ [![License](https://img.shields.io/badge/Apace-2.0-green)](LICENSE)
40
+ [![PyPI](https://img.shields.io/badge/PyPI-jucrypt-orange?logo=pypi)](https://pypi.org/project/jucrypt/)
41
+
42
+ STORY is an experimental symmetric block cipher in which the secret key is a natural-language narrative — a sentence, a paragraph, or any Unicode text — rather than a raw byte string. It operates on 128-bit blocks using a Substitution-Permutation Network (SPN), and provides authenticated encryption through CTR mode combined with HMAC-SHA-256 in an Encrypt-then-MAC construction. Please consider reading our paper bearing doi 10.31224/6477 before testing or using our STORY2.
43
+
44
+ The project is published as `jucrypt` on PyPI. The cipher, key derivation pipeline, and test suite are entirely open. We are conducting empirical security testing and would genuinely appreciate researchers using, testing, and critiquing the design.
45
+
46
+ ---
47
+
48
+ ## Current Limitations and Open Issues
49
+
50
+ We are disclosing all known issues in full. This is a pre-review cipher and transparency is more useful to the community than silence.
51
+
52
+ **Issue 1 — No formal peer review**
53
+
54
+ The cipher design, key derivation pipeline, and all empirical results above have not undergone external cryptanalysis or formal peer review. STORY should be treated as a research prototype. We are actively seeking differential, linear, algebraic, and structural cryptanalysis. If you attempt an attack, successful or not, we would like to hear about it.
55
+
56
+ **Issue 2 — IND-CPA composite pass rate of 97.7%**
57
+
58
+ The individual IND-CPA sub-tests (semantic security, length leakage, prefix indistinguishability) all pass at 100%. The composite failure originates in the statistical distribution test (98.8%) and the key-change test (99.0%). Approximately 1% false failures are expected under α = 0.01, but the remaining ~1.3% excess is currently under investigation. No confirmed root cause has been identified yet.
59
+
60
+ **Issue 3 — SAC measurement error in test suite prior to v4.2.0**
61
+
62
+ In `story_basic.py` versions prior to v4.2.0, the `sac_avg` column was numerically identical to `avalanche_pct / 100` — a redundant column carrying no independent information. The SAC figures in CSV files up to `story_basic_7.csv` should be read as a restatement of the avalanche figure, not an independent measurement. Fixed in v4.2.0, which now reports genuine per-output-bit SAC variance (`sac_std`, `sac_min_bit`, `sac_max_bit`).
63
+
64
+ **Issue 4 — BIC implementation error in test suite prior to v4.2.0**
65
+
66
+ The `_bic()` function in `story_deep.py` prior to v4.2.0 measured per-input-bit avalanche rate rather than the pairwise output-bit independence criterion defined by Webster and Tavares (1986). The BIC columns in `story_deep` CSV files prior to v4.2.0 are mislabelled and should be disregarded. Fixed in v4.2.0, which now computes Pearson correlation across all C(128, 2) = 8,128 output-bit pairs.
67
+
68
+ **Issue 5 — Variable round count increases timing variance**
69
+
70
+ Actual rounds per message vary from 8 to 15. This is intentional — it adds per-message variability — but it causes higher coefficient of variation in timing measurements than a fixed-round cipher would produce. The API does not currently expose a fixed-round mode, so timing benchmarks reflect an average over the round-count distribution.
71
+
72
+ **Issue 6 — C extension requires manual compilation**
73
+
74
+ The `story_core.c` extension provides roughly 10× throughput improvement but must be compiled manually. A pip-installable binary wheel is not yet available. The pure-Python fallback is automatic.
75
+
76
+ **Issue 7 — No custom S-box generation tooling yet**
77
+
78
+ A tool to generate validated custom S-box pools with verified DDT and LAT properties is planned but not yet released.
79
+
80
+ ---
81
+
82
+ ## Custom S-box Pool
83
+
84
+ STORY supports user-supplied S-boxes. If a file exists at `customju/sboxes.json` relative to `story.py`, it takes precedence over the default pool. Format:
85
+
86
+ ```json
87
+ {
88
+ "0": "1,200,87,...",
89
+ "1": "43,11,..."
90
+ }
91
+ ```
92
+
93
+ Each value is a comma-separated list of 256 integers forming a bijection of 0–255. Values are stored 1-indexed in the JSON (add 1 to each actual S-box value when writing). The loader validates each entry as a permutation of 0–255 and raises `ValueError` if the check fails.
94
+
95
+ Any custom pool should be validated for DDT max ≤ 4 and NL ≥ 112 before deployment. Pools with weaker properties will reduce the security margins reported in the test results above.
96
+
97
+ ---
98
+
99
+ ## For Researchers
100
+
101
+ **Source files**
102
+
103
+ | File | Contents |
104
+ |---|---|
105
+ | `story.py` | Pure-Python reference implementation, fully commented |
106
+ | `story2.py` | Pure-Python reference implementation, fully commented, no shiftrow and premute|
107
+ | `storyc.py` | C-accelerated variant and CLI |
108
+ | `story_core.c` | C extension: GF(2⁸) multiply table, MDS Mix, CTR-mode kernel |
109
+ | `default_sboxes.py` | S-BOX Pool file |
110
+
111
+ **Reproducing the test results**
112
+
113
+ ```bash
114
+ git clone https://github.com/w3nabil/jucrypt
115
+ cd jucrypt/analyse
116
+ pip install numpy scipy pulp
117
+ python story2_basic.py --workers 4
118
+ python story2_formal.py --quick
119
+ ```
120
+
121
+ **Attack surfaces we have not fully explored**
122
+
123
+ - Algebraic attacks exploiting the HMAC-based key schedule structure
124
+ - Related-story attacks (stories differing by a single character or punctuation mark)
125
+ - Timing side-channels in the pure-Python execution path
126
+ - The confirmed root cause of the 2.3% IND-CPA composite failure
127
+ - Invariant subspace attacks using the full round function under key-derived parameters
128
+
129
+ If you find a weakness — or confirm the absence of one — please open an issue or contact us directly. We would rather know.
130
+
131
+ ---
132
+
133
+ ## Citation
134
+
135
+ If you reference STORY2 or STORY in research, please cite:
136
+
137
+ ```
138
+ Islam, N. (2026). STORY2: A Fully Parameterised, Story-Key Driven SPN Cipher.
139
+ DOI: 10.31224/6477
140
+ ```
@@ -0,0 +1,110 @@
1
+ # Ju's Story (STORY)
2
+
3
+ > **Your story is your key.**
4
+ > A story-key driven Substitution-Permutation Network cipher.
5
+
6
+ > **Pre-review research cipher.** No external cryptanalysis or formal peer review has been conducted yet. We are actively seeking feedback from the research community. See [Current Limitations and Open Issues](#current-limitations-and-open-issues) before use.
7
+
8
+ [![Python](https://img.shields.io/badge/Python-3.9%2B-blue?logo=python)](https://www.python.org/)
9
+ [![License](https://img.shields.io/badge/Apace-2.0-green)](LICENSE)
10
+ [![PyPI](https://img.shields.io/badge/PyPI-jucrypt-orange?logo=pypi)](https://pypi.org/project/jucrypt/)
11
+
12
+ STORY is an experimental symmetric block cipher in which the secret key is a natural-language narrative — a sentence, a paragraph, or any Unicode text — rather than a raw byte string. It operates on 128-bit blocks using a Substitution-Permutation Network (SPN), and provides authenticated encryption through CTR mode combined with HMAC-SHA-256 in an Encrypt-then-MAC construction. Please consider reading our paper bearing doi 10.31224/6477 before testing or using our STORY2.
13
+
14
+ The project is published as `jucrypt` on PyPI. The cipher, key derivation pipeline, and test suite are entirely open. We are conducting empirical security testing and would genuinely appreciate researchers using, testing, and critiquing the design.
15
+
16
+ ---
17
+
18
+ ## Current Limitations and Open Issues
19
+
20
+ We are disclosing all known issues in full. This is a pre-review cipher and transparency is more useful to the community than silence.
21
+
22
+ **Issue 1 — No formal peer review**
23
+
24
+ The cipher design, key derivation pipeline, and all empirical results above have not undergone external cryptanalysis or formal peer review. STORY should be treated as a research prototype. We are actively seeking differential, linear, algebraic, and structural cryptanalysis. If you attempt an attack, successful or not, we would like to hear about it.
25
+
26
+ **Issue 2 — IND-CPA composite pass rate of 97.7%**
27
+
28
+ The individual IND-CPA sub-tests (semantic security, length leakage, prefix indistinguishability) all pass at 100%. The composite failure originates in the statistical distribution test (98.8%) and the key-change test (99.0%). Approximately 1% false failures are expected under α = 0.01, but the remaining ~1.3% excess is currently under investigation. No confirmed root cause has been identified yet.
29
+
30
+ **Issue 3 — SAC measurement error in test suite prior to v4.2.0**
31
+
32
+ In `story_basic.py` versions prior to v4.2.0, the `sac_avg` column was numerically identical to `avalanche_pct / 100` — a redundant column carrying no independent information. The SAC figures in CSV files up to `story_basic_7.csv` should be read as a restatement of the avalanche figure, not an independent measurement. Fixed in v4.2.0, which now reports genuine per-output-bit SAC variance (`sac_std`, `sac_min_bit`, `sac_max_bit`).
33
+
34
+ **Issue 4 — BIC implementation error in test suite prior to v4.2.0**
35
+
36
+ The `_bic()` function in `story_deep.py` prior to v4.2.0 measured per-input-bit avalanche rate rather than the pairwise output-bit independence criterion defined by Webster and Tavares (1986). The BIC columns in `story_deep` CSV files prior to v4.2.0 are mislabelled and should be disregarded. Fixed in v4.2.0, which now computes Pearson correlation across all C(128, 2) = 8,128 output-bit pairs.
37
+
38
+ **Issue 5 — Variable round count increases timing variance**
39
+
40
+ Actual rounds per message vary from 8 to 15. This is intentional — it adds per-message variability — but it causes higher coefficient of variation in timing measurements than a fixed-round cipher would produce. The API does not currently expose a fixed-round mode, so timing benchmarks reflect an average over the round-count distribution.
41
+
42
+ **Issue 6 — C extension requires manual compilation**
43
+
44
+ The `story_core.c` extension provides roughly 10× throughput improvement but must be compiled manually. A pip-installable binary wheel is not yet available. The pure-Python fallback is automatic.
45
+
46
+ **Issue 7 — No custom S-box generation tooling yet**
47
+
48
+ A tool to generate validated custom S-box pools with verified DDT and LAT properties is planned but not yet released.
49
+
50
+ ---
51
+
52
+ ## Custom S-box Pool
53
+
54
+ STORY supports user-supplied S-boxes. If a file exists at `customju/sboxes.json` relative to `story.py`, it takes precedence over the default pool. Format:
55
+
56
+ ```json
57
+ {
58
+ "0": "1,200,87,...",
59
+ "1": "43,11,..."
60
+ }
61
+ ```
62
+
63
+ Each value is a comma-separated list of 256 integers forming a bijection of 0–255. Values are stored 1-indexed in the JSON (add 1 to each actual S-box value when writing). The loader validates each entry as a permutation of 0–255 and raises `ValueError` if the check fails.
64
+
65
+ Any custom pool should be validated for DDT max ≤ 4 and NL ≥ 112 before deployment. Pools with weaker properties will reduce the security margins reported in the test results above.
66
+
67
+ ---
68
+
69
+ ## For Researchers
70
+
71
+ **Source files**
72
+
73
+ | File | Contents |
74
+ |---|---|
75
+ | `story.py` | Pure-Python reference implementation, fully commented |
76
+ | `story2.py` | Pure-Python reference implementation, fully commented, no shiftrow and premute|
77
+ | `storyc.py` | C-accelerated variant and CLI |
78
+ | `story_core.c` | C extension: GF(2⁸) multiply table, MDS Mix, CTR-mode kernel |
79
+ | `default_sboxes.py` | S-BOX Pool file |
80
+
81
+ **Reproducing the test results**
82
+
83
+ ```bash
84
+ git clone https://github.com/w3nabil/jucrypt
85
+ cd jucrypt/analyse
86
+ pip install numpy scipy pulp
87
+ python story2_basic.py --workers 4
88
+ python story2_formal.py --quick
89
+ ```
90
+
91
+ **Attack surfaces we have not fully explored**
92
+
93
+ - Algebraic attacks exploiting the HMAC-based key schedule structure
94
+ - Related-story attacks (stories differing by a single character or punctuation mark)
95
+ - Timing side-channels in the pure-Python execution path
96
+ - The confirmed root cause of the 2.3% IND-CPA composite failure
97
+ - Invariant subspace attacks using the full round function under key-derived parameters
98
+
99
+ If you find a weakness — or confirm the absence of one — please open an issue or contact us directly. We would rather know.
100
+
101
+ ---
102
+
103
+ ## Citation
104
+
105
+ If you reference STORY2 or STORY in research, please cite:
106
+
107
+ ```
108
+ Islam, N. (2026). STORY2: A Fully Parameterised, Story-Key Driven SPN Cipher.
109
+ DOI: 10.31224/6477
110
+ ```
@@ -3,6 +3,7 @@ from .storyc import STORYC
3
3
  from .story import STORY
4
4
  from .story256 import STORY256
5
5
  from .story256c import STORYC256
6
+ from .story2 import STORY2
6
7
 
7
- __all__ = ["SBOX_POOL", "STORYC", "STORY", "STORY256", "STORYC256"]
8
- __version__= "0.3.2"
8
+ __all__ = ["SBOX_POOL", "STORYC", "STORY", "STORY256", "STORYC256", "STORY2"]
9
+ __version__= "0.4.0"