YUA Compressor: custom compression format with optional AES-GCM encryption (zlib/zstd)
Project description
YUA Compressor (yua-compressor)
自作フォーマット + 可逆圧縮 (zlib / zstd) + AES-GCM暗号化(任意) のPythonライブラリ & CLI。
- 拡張子: 推奨
*.yuac - 形式: ヘッダー(固定長+可変) + ペイロード
- 暗号化: AES-256-GCM(
cryptography)/ PBKDF: scrypt(塩付き) - 圧縮: zlib(標準)/ zstd(オプション依存
pip install yua-compressor[zstd])
インストール
pip install .
# もしくは zstd有効化
pip install .[zstd]
使い方(Python API)
from yua_compressor import compress_bytes, decompress_bytes
data = b"Hello YUA!" * 1000
blob = compress_bytes(data, algo="zstd", level=3, password="secret") # bytes -> .yuac相当
plain = decompress_bytes(blob, password="secret")
assert plain == data
CLI
# 圧縮
yuac c input.bin -o output.yuac -a zstd -l 6 -p "pass"
# 展開
yuac x output.yuac -o restored.bin -p "pass"
ヘッダー仕様(v1)
offset size desc
0 4 magic = "YUAC"
4 1 version = 1
5 1 flags: bit0 = encrypted(1/0)
6 1 algo: 0=store 1=zlib 2=zstd
7 1 reserved
8 8 original_size (little endian, uint64)
16 16 checksum = blake2s(original, 16 bytes)
32 16 salt (present if encrypted)
48 12 nonce (present if encrypted)
# 以降 payload:
# encrypted ? AES-GCM(ciphertext) : compressed-bytes
検証は復号→伸長→チェックサム照合の順で行います。
ライセンス
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yua_compressor-0.1.1.tar.gz
(5.8 kB
view details)
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 yua_compressor-0.1.1.tar.gz.
File metadata
- Download URL: yua_compressor-0.1.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ddbd9488cc75ac13b4285e31174b27859d8f4d2910d37fb10e55de4ba5a809c
|
|
| MD5 |
5c30e34093a37aa6413203be1ed5adba
|
|
| BLAKE2b-256 |
dae25ba4d92415f348585d67a7ba9cd611030da7a691a2e67fd6a4d8766f3c70
|
File details
Details for the file yua_compressor-0.1.1-py3-none-any.whl.
File metadata
- Download URL: yua_compressor-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1db7aa07110f4527226e0ba6df77a1fb8e0c963da954cb98a9db78946cb530d
|
|
| MD5 |
fc03af252c4db14d9cf4efe65fb430b8
|
|
| BLAKE2b-256 |
acd3f24726d59df42dd9b20859d17733083a42fa658f2843c0964e51ac1c0a13
|