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
- 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.
- Start the bit stuffing by calling the
.startStuffing()
method. - The input sequence is obtained as
.sequence
object. - The bit stuffed sequence is available as the
.stuffed
object. - The un-stuffed sequence can be obtained as the
.unStuffed
object. - 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.
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
- 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.
- Start the bit stuffing by calling the
.startStuffing()
method. - The input sequence is obtained as
.sequence
object. - The bytes stuffed sequence is available as the
.stuffed
object. - 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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f70b8430d7299bc5c6bc17e74c50393eeca7e044ea93201f286c02cb9f9a5695 |
|
MD5 | 14e312a74327dbbe6b24af0781484ca0 |
|
BLAKE2b-256 | 85c53b5a23b24c6c488d856a92929f7ea26094efa0f3aeb64d430dbed2fc900e |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01263ec30d98216000706df77042950a6d77d0d61a24a2a1c1d491883bc43fc8 |
|
MD5 | 6ef47064bf3074444033bb21794bd9b1 |
|
BLAKE2b-256 | 0f01db572e37a75efaa690238d31ce77990247b3e630fdb5615fdc0e11cabf4c |