Universal Systems Runtime — experimental C core with Python bindings
Project description
usr — Universal Systems Runtime (pre‑release)
⚠️ Pre‑release / Experimental
This project is an early, curiosity‑driven build created to explore low‑level systems programming, binary processing, and cryptography.
It is NOT recommended for production use.
This is the first real release after placeholders, published mainly for learning, experimentation, and architectural exploration.
✨ Overview
usr (Universal Systems Runtime) is a low‑level systems library written in C, with optional Python bindings, designed to experiment with:
- Binary & byte manipulation
- UTF‑8 / UTF‑16 handling
- Cryptographic primitives (SHA‑256, AES‑256‑IGE)
- Telegram‑style text entities & formatting
- Markdown ⇄ HTML ⇄ Entity round‑tripping
- Performance‑oriented, minimal abstractions
This project exists to understand how real systems libraries are built, not to replace existing production‑grade tools.
🧠 Project Philosophy
-
Written from scratch in C
-
Clear separation between core logic and language bindings
-
Focus on determinism, memory ownership, and correctness
-
Minimal abstractions, explicit APIs
-
Inspired by projects such as:
cryptgtgcrypto- Telegram MTProto internals
The goal is understanding systems internals, not shipping a black‑box dependency.
🚧 Current Status
- ✔ Core C library: stable for experimentation
- ✔ Extensive internal tests (round‑trip, fuzz, stress)
- ✔ Python wrapper available (experimental)
- ❌ Not production‑ready
- ❌ Android / Termux has known limitations
⚠️ Packaging Status (Important)
The Python package is not fully ready for universal PyPI usage yet.
- Current releases are experimental
- Native components are expected to be built locally
- Prebuilt wheels may be incomplete or platform‑limited
For now, usr is primarily intended to be built from source for reliable results.
Full, cross‑platform PyPI support (Linux/macOS/Windows wheels) will be added in a future release once the build system is finalized.
📦 Installation
Supported environments
- Linux (native C / Python)
- macOS (native C / Python)
- Android / Termux (C‑only recommended)
✅ Recommended (Current)
Build locally from source:
git clone https://github.com/ankit-chaubey/usr
cd usr
mkdir build && cd build
cmake ..
make
This is the most reliable and supported way to use usr at the moment.
Python (Experimental)
pip install usr
Python bindings are provided for exploration only.
Native components may still require local compilation depending on platform.
🧪 Example Usage (Python)
1️⃣ Text ⇄ Binary
from usr import from_text, to_text
raw = from_text("Hello usr 🚀")
print(raw)
text = to_text(raw)
print(text)
Demonstrates:
- UTF‑8 safety
- Binary ownership handling
- Round‑trip correctness
2️⃣ Hashing (SHA‑256)
from usr import sha256
print(sha256(b"test").hex())
3️⃣ AES‑256‑IGE (Experimental)
from usr import aes256_ige_encrypt, aes256_ige_decrypt
key = b"\x11" * 32
iv = b"\x22" * 32
msg = b"0123456789ABCDEF0123456789ABCDEF"
enc = aes256_ige_encrypt(msg, key, iv)
dec = aes256_ige_decrypt(enc, key, iv)
print(dec)
⚠️ Notes:
- May abort on Android / Termux via
ctypes - Works correctly on Linux/macOS
- Prefer pure C or NDK/JNI on Android
🗂️ Project Structure
usr/
├── CMakeLists.txt
├── LICENSE
├── README.md
├── examples/
│ └── full_demo.c
├── include/
│ └── usr/
│ ├── binary.h
│ ├── bytes.h
│ ├── crypto.h
│ ├── entities.h
│ ├── html.h
│ ├── markdown.h
│ ├── media.h
│ ├── usr.h
│ ├── utf8.h
│ └── version.h
├── python/
│ ├── MANIFEST.in
│ ├── README.md
│ ├── pyproject.toml
│ ├── setup.py
│ └── usr/
│ ├── __init__.py
│ ├── binary.py
│ ├── crypto.py
│ ├── entities.py
│ ├── html.py
│ └── markdown.py
├── src/
│ ├── binary/
│ │ └── binary.c
│ ├── bytes/
│ │ └── bytes.c
│ ├── crypto/
│ │ ├── aes_block.c
│ │ ├── aes_block_decrypt.c
│ │ ├── aes_ige.c
│ │ ├── aes_tables.c
│ │ ├── aes_tables.h
│ │ ├── crypto_stub.c
│ │ └── sha256.c
│ ├── entities/
│ │ ├── entities_stub.c
│ │ └── normalize.c
│ ├── html/
│ │ ├── entities_to_html.c
│ │ ├── entities_to_html_rt.c
│ │ ├── html.c
│ │ └── html_stub.c
│ ├── markdown/
│ │ ├── markdown.c
│ │ └── markdown_stub.c
│ ├── media/
│ │ └── media.c
│ └── utf8/
│ └── utf8.c
├── tests/
│ ├── entity_eq.h
│ ├── fuzz_roundtrip.c
│ └── test_roundtrip.c
├── tools/
│ ├── test1.py
│ ├── test2.py
│ └── test3_hard.py
└── wrappers/
🧩 Available APIs
Binary / Text
from_text(str) -> bytesto_text(bytes) -> str
Cryptography
sha256(data: bytes) -> bytesaes256_ige_encrypt(data, key, iv)(experimental)aes256_ige_decrypt(data, key, iv)(experimental)
Text Processing (C‑side)
- UTF‑8 decoding
- Markdown parsing (Telegram‑style)
- HTML ⇄ Entity conversion
- Entity normalization & round‑trip validation
📱 Android / Termux Note
On Android (Termux):
ctypes+ native crypto may abort due to Bionic tagged‑pointer protection- Binary/text APIs work in pure C
- SHA‑256 works internally
Recommended:
- Use pure‑Python fallbacks
- Or integrate the C core via NDK/JNI
🧪 Testing
cd build
ctest
Manual Python check:
python - << 'EOF'
from usr import from_text, to_text, sha256
print(to_text(from_text("test")))
print(sha256(b"test").hex())
EOF
👤 Author & Credits
Author: Ankit Chaubey
GitHub: https://github.com/ankit-chaubey
Inspired by open‑source systems projects such as cryptg and tgcrypto.
🔗 Repository
https://github.com/ankit-chaubey/usr
🧭 Final Note
This repository represents a learning milestone, not a finished product.
It documents real engineering trade‑offs: ABI boundaries, memory ownership, platform limitations, and performance considerations.
If you are reading this, you are looking at a hands‑on exploration of systems programming, not a polished framework.
Feedback, discussion, and curiosity are always welcome 🤝
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file usr-0.1.2b1.tar.gz.
File metadata
- Download URL: usr-0.1.2b1.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42f81a755c927213cf8ecba543c7018c49dc3ff121408eb7c5ff8acfb729a96d
|
|
| MD5 |
167086d3d9a63d66c9d2075429506ced
|
|
| BLAKE2b-256 |
329e25d0c4d628a293c295aeef2a3c3ce6d79e5aa55c3d7f249df38565d835b8
|
Provenance
The following attestation bundles were made for usr-0.1.2b1.tar.gz:
Publisher:
publish.yml on ankit-chaubey/usr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
usr-0.1.2b1.tar.gz -
Subject digest:
42f81a755c927213cf8ecba543c7018c49dc3ff121408eb7c5ff8acfb729a96d - Sigstore transparency entry: 869298845
- Sigstore integration time:
-
Permalink:
ankit-chaubey/usr@06161258c3c48b3cf7556b7102c414275b3e611f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06161258c3c48b3cf7556b7102c414275b3e611f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file usr-0.1.2b1-py3-none-any.whl.
File metadata
- Download URL: usr-0.1.2b1-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459d3e03d3d1ff9e805700946eb7ec676a5e9518606f91509e746d2db966fdba
|
|
| MD5 |
133b946b1ef92f3935ddb5d88ba9123f
|
|
| BLAKE2b-256 |
8fa44fc6373a2130f6d0b5e72d83ec23735f72d6857f039c46df02322b0287aa
|
Provenance
The following attestation bundles were made for usr-0.1.2b1-py3-none-any.whl:
Publisher:
publish.yml on ankit-chaubey/usr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
usr-0.1.2b1-py3-none-any.whl -
Subject digest:
459d3e03d3d1ff9e805700946eb7ec676a5e9518606f91509e746d2db966fdba - Sigstore transparency entry: 869298858
- Sigstore integration time:
-
Permalink:
ankit-chaubey/usr@06161258c3c48b3cf7556b7102c414275b3e611f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06161258c3c48b3cf7556b7102c414275b3e611f -
Trigger Event:
workflow_dispatch
-
Statement type: