Skip to main content

An extensible, legible, line-based, elegant data solution!

Project description

PyELLE

Originally developed for use in a custom cryptographic protocol, ELLE format is
extensible, legible, line-based, and elegant!

Data encoded in ELLE looks like this:

|MESSAGE|
TEXT$PLAINTEXT$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
DATA$FLAGS,CAN,BE,ANYTHING$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
OR NOTHING$$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
|/MESSAGE|

The data header can be anything, from MESSAGE to PACKET to LOVE LETTER.
The field names can be anything, and the flags can be anything. Fully extensible.

PyELLE implements ELLE format into Python with these functions and classes:

class ELLEEntry

  • self.name
  • self.flags
  • self.value

class ELLEFile

  • def find_entry_with_name(self, name: str) -> ELLEEntry | None
  • def save_file(self, file_name: str) -> None
  • def set_data_name(self, data_name: str) -> None
  • def add_entry(self, entry: ELLEEntry) -> None

def elle_encode(data_type: str, entries: list[ELLEEntry]) -> str def elle_decode(encoded: str) -> ELLEFile

For example:

from pyelle import ELLEEntry, ELLEFile, elle_decode, elle_encode

data = b'This is Base64 data.'

entries = (
    ELLEEntry("TEXT", ("PLAINTEXT",), data),
    ELLEEntry("DATA", ("FLAGS", "CAN", "BE", "ANYTHING"), data),
    ELLEEntry("OR NOTHING", (), data)
)

elle_file = ELLEFile(data_name="MESSAGE", values=entries)

# Data is automatically base64 encoded on save.
elle_file.save_file("message.elle")

elle_str = str(elle_file)

print(elle_str)
# Will output:
#
# |MESSAGE|
# TEXT$PLAINTEXT$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# DATA$FLAGS,CAN,BE,ANYTHING$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# OR NOTHING$$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# |/MESSAGE|

# Will reconstruct `elle_file` from str.
reconstructed_elle_file = elle_decode(elle_str)

# Does the same thing as str(ELLEFile)
elle_str = elle_encode("MESSAGE", entries)

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

pyelle-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

pyelle-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyelle-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyelle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d098a114bfe530078a85bd5d60b0c75a539126d04508275760489daeada39ae0
MD5 441cf772e487bb367a7ed02d726f97a9
BLAKE2b-256 74e6ca4affa623f408c0eebfb38ece881f8896af7e34f00c17e586ec8da6630d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyelle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyelle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8e7b5dfd0ba7d6f2e9a38b7b623e722513787aa56929b1d6330f493f337130f
MD5 dd545b57b58d4978a8a06b10af468101
BLAKE2b-256 fca87881a015010b483a375bcd2a826948a6adc54a40ee8ece87c9667e4fa753

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