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.3.tar.gz (6.3 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.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yua_compressor-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 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.3.tar.gz
Algorithm Hash digest
SHA256 dffb38b691941d0a60fecae838655c16ec0a7fe2ed0cc94788f08dc5f526cf71
MD5 024bda27fb6110b6e0be6d1f529e5062
BLAKE2b-256 a20d8c431d4556546e8fe76fa5a561a2f0122abbd16a7394ffd9e7e13d73e3e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yua_compressor-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c1efc800456925e7f6bfe72a1db79d71511df5d8a141f4fcc5b2685db44799f1
MD5 329fbc97c6d5323502ec81f6f030aa0e
BLAKE2b-256 b43f3155406d9e1c7160e754d35d4d8311b3d4a2ddc6e98c57ec3639459940bc

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