enc67 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.
enc67-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Snorre
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.
enc67-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: enc67
3
+ Version: 0.1.0
4
+ Summary: Encode bytes as a stream of 67s and 76s, with optional XOR obfuscation.
5
+ Project-URL: Homepage, https://pypi.org/project/enc67/
6
+ Author-email: Snorre <snorre@addmedia.no>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Keywords: 67,encoding,fun,obfuscation
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Topic :: Utilities
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+
19
+ # enc67
20
+
21
+ Encode bytes as a stream of `67` and `76` tokens. Optional repeating-XOR key for light obfuscation.
22
+
23
+ > ⚠️ **Not real encryption.** The optional key is repeating-XOR (Vigenère on bytes). Use it as a toy or for fun — not for secrets.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install enc67
29
+ ```
30
+
31
+ ## Use it
32
+
33
+ ```python
34
+ from enc67 import encrypt, decrypt
35
+
36
+ ct = encrypt("Hi", key="secret")
37
+ # '67 67 76 76 76 67 76 76 67 67 67 67 76 76 67 67'
38
+
39
+ decrypt(ct, key="secret")
40
+ # 'Hi'
41
+ ```
42
+
43
+ Or from the CLI:
44
+
45
+ ```bash
46
+ enc67 encrypt "Hi" secret
47
+ enc67 decrypt "67 67 76 ..." secret
48
+ ```
49
+
50
+ ## How it works
51
+
52
+ 1. Encode UTF-8.
53
+ 2. (Optional) XOR with the repeating key.
54
+ 3. For each byte, emit 8 tokens: `67` for bit `0`, `76` for bit `1`, big-endian.
55
+
56
+ No key → pure encoding. With a key → toy obfuscation.
57
+
58
+ ## License
59
+
60
+ MIT.
enc67-0.1.0/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # enc67
2
+
3
+ Encode bytes as a stream of `67` and `76` tokens. Optional repeating-XOR key for light obfuscation.
4
+
5
+ > ⚠️ **Not real encryption.** The optional key is repeating-XOR (Vigenère on bytes). Use it as a toy or for fun — not for secrets.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install enc67
11
+ ```
12
+
13
+ ## Use it
14
+
15
+ ```python
16
+ from enc67 import encrypt, decrypt
17
+
18
+ ct = encrypt("Hi", key="secret")
19
+ # '67 67 76 76 76 67 76 76 67 67 67 67 76 76 67 67'
20
+
21
+ decrypt(ct, key="secret")
22
+ # 'Hi'
23
+ ```
24
+
25
+ Or from the CLI:
26
+
27
+ ```bash
28
+ enc67 encrypt "Hi" secret
29
+ enc67 decrypt "67 67 76 ..." secret
30
+ ```
31
+
32
+ ## How it works
33
+
34
+ 1. Encode UTF-8.
35
+ 2. (Optional) XOR with the repeating key.
36
+ 3. For each byte, emit 8 tokens: `67` for bit `0`, `76` for bit `1`, big-endian.
37
+
38
+ No key → pure encoding. With a key → toy obfuscation.
39
+
40
+ ## License
41
+
42
+ MIT.
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "enc67"
7
+ version = "0.1.0"
8
+ description = "Encode bytes as a stream of 67s and 76s, with optional XOR obfuscation."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.8"
12
+ authors = [{ name = "Snorre", email = "snorre@addmedia.no" }]
13
+ keywords = ["encoding", "obfuscation", "fun", "67"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Topic :: Security :: Cryptography",
20
+ "Topic :: Utilities",
21
+ ]
22
+
23
+ [project.scripts]
24
+ enc67 = "enc67.__main__:main"
25
+
26
+ [project.urls]
27
+ Homepage = "https://pypi.org/project/enc67/"
28
+
29
+ [tool.hatch.build.targets.wheel]
30
+ packages = ["src/enc67"]
@@ -0,0 +1,9 @@
1
+ """enc67 — encode bytes as a stream of 67s and 76s, with optional XOR obfuscation.
2
+
3
+ WARNING: the optional key is repeating-XOR (Vigenère on bytes). It is OBFUSCATION,
4
+ not cryptography. Do not use this to protect real secrets.
5
+ """
6
+ from .core import encrypt, decrypt, encode, decode
7
+
8
+ __all__ = ["encrypt", "decrypt", "encode", "decode"]
9
+ __version__ = "0.1.0"
@@ -0,0 +1,22 @@
1
+ """CLI: python -m enc67 encrypt|decrypt <text> [key]"""
2
+ import sys
3
+ from .core import encrypt, decrypt
4
+
5
+
6
+ def main() -> None:
7
+ if len(sys.argv) < 3:
8
+ print("usage: enc67 [encrypt|decrypt] <text> [key]", file=sys.stderr)
9
+ sys.exit(2)
10
+ mode, text = sys.argv[1], sys.argv[2]
11
+ key = sys.argv[3] if len(sys.argv) > 3 else ""
12
+ if mode == "encrypt":
13
+ print(encrypt(text, key))
14
+ elif mode == "decrypt":
15
+ print(decrypt(text, key))
16
+ else:
17
+ print(f"unknown mode: {mode}", file=sys.stderr)
18
+ sys.exit(2)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
@@ -0,0 +1,56 @@
1
+ """Core encode/decode + obfuscation primitives."""
2
+ from __future__ import annotations
3
+
4
+
5
+ def _key_stream(key: bytes, n: int) -> bytes:
6
+ if not key:
7
+ return b"\x00" * n
8
+ return bytes(key[i % len(key)] for i in range(n))
9
+
10
+
11
+ def encode(data: bytes) -> str:
12
+ """Encode raw bytes as space-separated 67/76 tokens (8 per byte)."""
13
+ tokens = []
14
+ for byte in data:
15
+ for i in range(7, -1, -1):
16
+ tokens.append("76" if (byte >> i) & 1 else "67")
17
+ return " ".join(tokens)
18
+
19
+
20
+ def decode(tokens_str: str) -> bytes:
21
+ """Decode a 67/76 token stream back into bytes."""
22
+ tokens = tokens_str.split()
23
+ if len(tokens) % 8 != 0:
24
+ raise ValueError(f"token count {len(tokens)} is not a multiple of 8")
25
+ out = bytearray()
26
+ for i in range(0, len(tokens), 8):
27
+ byte = 0
28
+ for t in tokens[i:i + 8]:
29
+ if t == "67":
30
+ bit = 0
31
+ elif t == "76":
32
+ bit = 1
33
+ else:
34
+ raise ValueError(f"bad token {t!r} — expected 67 or 76")
35
+ byte = (byte << 1) | bit
36
+ out.append(byte)
37
+ return bytes(out)
38
+
39
+
40
+ def encrypt(plaintext: str, key: str = "") -> str:
41
+ """XOR plaintext (UTF-8) with repeating key, then 67/76-encode.
42
+
43
+ With no key this is just encoding. With a key it is repeating-XOR
44
+ obfuscation — not real encryption.
45
+ """
46
+ data = plaintext.encode("utf-8")
47
+ ks = _key_stream(key.encode("utf-8"), len(data))
48
+ xored = bytes(b ^ k for b, k in zip(data, ks))
49
+ return encode(xored)
50
+
51
+
52
+ def decrypt(ciphertext: str, key: str = "") -> str:
53
+ """Inverse of encrypt — returns UTF-8 plaintext."""
54
+ data = decode(ciphertext)
55
+ ks = _key_stream(key.encode("utf-8"), len(data))
56
+ return bytes(b ^ k for b, k in zip(data, ks)).decode("utf-8")