Skip to main content

A Python package for performing Bit Stuffing and Byte Stuffing operations

Project description

Python library to perform Bit Stuffing and Byte Stuffing

To install

pip install pyStuffing

1. Bit Stuffing usage example.

from pyStuffing import BitStuffing
from pyStuffing import clear

if __name__ == "__main__":
    stuff = BitStuffing()
    stuff.startStuffing() # START STUFFING
    stuff.startUnstuffing()

    clear() # CLEAR SCREEN

    # PRINT SEQUENCES TO SCREEN
    print("Main Sequence:       {}".format(stuff.sequence))
    print("Stuffed Sequence:    {}".format(stuff.stuffed))
    print("Un-Stuffed Sequence: {}".format(stuff.unStuffed))
    print("Stuffed Sequence:    {}".format(stuff.getStuffedColored()))

Explanation

  1. Inititallise the class BitStuffing() You can pass the bit sequence to the class as a list.
  • BitStuffing([0,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0])
  • If nothing is passed on to the class, you will be prompted for input.
  1. Start the bit stuffing by calling the .startStuffing() method.
  2. The input sequence is obtained as .sequence object.
  3. The bit stuffed sequence is available as the .stuffed object.
  4. The un-stuffed sequence can be obtained as the .unStuffed object.
  5. The .getStuffedColored() returns the stuffed sequence along with the added flags, when printed, explicitly differentiates between the colors of the main sequence, bits stuffed and the flag. Example Colored Output

2. Byte Stuffing usage example.

from pyStuffing import ByteStuffing
from pyStuffing import clear


if __name__ == "__main__":
    stuff = ByteStuffing(list("abcdefghijklmnopqrstuvwxyz".upper()), escape_character="E", flag_character="F")
    # stuff = ByteStuffing()
    stuff.startStuffing()
    stuff.startUnStuffing()

    clear()

    print("Sequence:  {}".format(stuff.sequence))
    print("Stuffed:   {}".format(stuff.stuffed))
    print("Un-stuffed: {}".format(stuff.unStuffed))

Explanation

  1. Initiallise the class ByteStuffing() You can pass the byte sequence to the class as a list.
  • ByteStuffing(list("abcdefghijklmnopqrstuvwxyz".upper()))
  • If nothing is passed on to the class, you will be prompted for input.
  1. Start the bit stuffing by calling the .startStuffing() method.
  2. The input sequence is obtained as .sequence object.
  3. The bytes stuffed sequence is available as the .stuffed object.
  4. The un-stuffed sequence can be obtained as the .unStuffed object.

Note:

You can set the .stuffed object to the stuffed sequence and call the .startUnstuffing() to unstuff the sequence and be obtained sa the .unStuffed object.

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

pyStuffing-0.0.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pyStuffing-0.0.4-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pyStuffing-0.0.4.tar.gz.

File metadata

  • Download URL: pyStuffing-0.0.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for pyStuffing-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f70b8430d7299bc5c6bc17e74c50393eeca7e044ea93201f286c02cb9f9a5695
MD5 14e312a74327dbbe6b24af0781484ca0
BLAKE2b-256 85c53b5a23b24c6c488d856a92929f7ea26094efa0f3aeb64d430dbed2fc900e

See more details on using hashes here.

File details

Details for the file pyStuffing-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pyStuffing-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for pyStuffing-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 01263ec30d98216000706df77042950a6d77d0d61a24a2a1c1d491883bc43fc8
MD5 6ef47064bf3074444033bb21794bd9b1
BLAKE2b-256 0f01db572e37a75efaa690238d31ce77990247b3e630fdb5615fdc0e11cabf4c

See more details on using hashes here.

Supported by

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