Skip to main content

Zero-free encoding framework: signed bijective numeration (Rahu) and arithmetic coding (Ketu).

Project description

rahuketu

rahuketu is a small zero-free encoding package. It combines a signed bijective number path (Rahu) with an arithmetic-coding path (Ketu), and records both as a log-space trace. Pure Python, no dependencies.

Install

pip install rahuketu

Usage

from rahuketu import Alphabet, roundtrip, trace

ab = Alphabet.lowercase()

r = roundtrip("hello", ab)
assert r["agrees"]            # encode -> decode is lossless

steps = trace("hello", ab)
last = steps[-1]
print(last.tau, last.upsilon, last.redundancy)

Components

  • Alphabet - no-zero symbol/digit mapping (digits in [1, b]).
  • Rahu - signed bijective numeration (RahuState, rahu_encode, rahu_decode).
  • Ketu - arithmetic coding as (midpoint, scale) (KetuState, ketu_encode, ketu_decode).
  • trace - records (tau, upsilon, a) over the input.
  • roundtrip - checks lossless encode/decode.

Provenance / AI assistance

Built by Ramakrishnan (ORCID 0009-0006-0905-7275). Signed and bijective numeration and arithmetic coding are classical methods. The zero-free Rahu-Ketu framing and this implementation are original. AI tools helped with tests, automation, and QA. The idea and direction are the author's.

License

Apache-2.0. See LICENSE and NOTICE.

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

rahuketu-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

rahuketu-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rahuketu-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rahuketu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4518e02d57400123beb61e9709703d1439289e44ff53c819ec101e2dc6655201
MD5 56b43ee46d1fd4ee09279b93fda1a3ad
BLAKE2b-256 8220f3086dd8194facfa0dd6bf33aaca1571571d01d566fee2b6f2329459061a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rahuketu-0.1.0.tar.gz:

Publisher: publish.yml on decipherpunk/rahuketu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: rahuketu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rahuketu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68cf31273adec6eb5d92c3b0b8855ee6faf886387f7f92527342e6a1adfed81d
MD5 ef48781b094d851800e0703a5447e78f
BLAKE2b-256 26a9a6ac5ce86f851ae5ff8169516ab5218926f2a413a30f68e3f53e6f5915e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rahuketu-0.1.0-py3-none-any.whl:

Publisher: publish.yml on decipherpunk/rahuketu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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