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.2.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.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yua_compressor-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0d788dd60dbd21438e66c7ede4dcad420bfc0a4618ecd1ecf167d7d3ce154142
MD5 bc3fd542466686f9887b579a25f45527
BLAKE2b-256 18d719bda7fb37906d503c56d91b780416f441a03116c286085acc10010b0ef1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yua_compressor-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8e4fce43c0fdf0e8d7c69f8ec5a8df975fcf74149b748ded8956145015075996
MD5 82cf354646219707bdbf817a8d5e9455
BLAKE2b-256 132dbe77db714a32bc6d5e1c847151aa09f8e633eba515833a27fe28bfcea7ba

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