Skip to main content

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.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yua_compressor-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file yua_compressor-0.1.0.tar.gz.

File metadata

  • Download URL: yua_compressor-0.1.0.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

Hashes for yua_compressor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4de62a9b980f5f59932a7b71c29fc0a1959fa4ff6fa6c7ea3804c25f6cd5807f
MD5 169d867f2ff8ce30670e6d4bd50bf7d0
BLAKE2b-256 d26dcbfb8652ab9c100cf03e08d03d32dd9a053bc567c630a74caf8fa2c5d896

See more details on using hashes here.

File details

Details for the file yua_compressor-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yua_compressor-0.1.0-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

Hashes for yua_compressor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b11d9b7bbbc261dc40c05dabf7eacd3fdc9929e19053e4fe1f5bcec91b506e02
MD5 d011a4d619769ab4ca63b6c1ce088957
BLAKE2b-256 3a63a29b2c9391652709340c960270c28e37a93ea37d7286a40502b36eba37d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page