A simple Python CLI tool to pad a binary file to a specified size using a given byte value.
Project description
Binary File Padding Tool
A simple Python CLI tool to pad a binary file to a specified size using a given byte value.
Features
- Pads any binary file to a target size
- Customizable padding byte value
- Simple command-line interface
- Version flag support
Requirements
- Python 3.6 or higher
Install dependencies using:
pip install -r requirements.txt
Installation
Clone the repository.
git clone git@github.com:gilweis/padding-tool.git
cd padding-tool
Usage
python -m padding_tool --in INPUT_FILE --out OUTPUT_FILE --needed_size SIZE --padding_value VALUE
Arguments
| Argument | Description |
|---|---|
--in |
Path to the input binary file |
--out |
Path to save the padded output file |
--needed_size |
Total desired size of the output file (in bytes) |
--padding_value |
Byte value to use for padding (0–255) |
--version |
Show program version and exit |
Example
python -m padding_tool --in firmware.bin --out padded_firmware.bin --needed_size 4096 --padding_value 255
This command reads firmware.bin, pads it with 0xFF (255) bytes until the size is 4096 bytes,
and writes the result to padded_firmware.bin.
Exit Codes
0: File padded successfully1: Failed to pad the file
Error Handling
- If the input file is larger than
--needed_size, the program will raise an error and stop. - Ensure that
--padding_valueis in the valid range0–255.
Build and Install
To build source and wheel distributions:
python -m build
If you don't have the build tool installed:
pip install build
To install the package locally:
pip install .
To upload to PyPI (optional):
pip install twine twine upload dist/*
License
MIT License
Version
1.0.3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file padding_tool-1.0.3.tar.gz.
File metadata
- Download URL: padding_tool-1.0.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcc048e6a4b9799ba1baec8f86613c2111f83599e73d06ac52bbdaa46c76406a
|
|
| MD5 |
e1d4fda5406e3d4de848116fe9b0b89d
|
|
| BLAKE2b-256 |
d61c92cd7056a085b65e99c0fe5b1047221454d9748aadd03f55a126042b8638
|
File details
Details for the file padding_tool-1.0.3-py3-none-any.whl.
File metadata
- Download URL: padding_tool-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20fae3374de2ab611969fcfb631171a4cb9e34ad4bca4ff9e24bdac122032e8d
|
|
| MD5 |
a0a6b2da7c2f6add70f860b01d76416b
|
|
| BLAKE2b-256 |
5e7883f6e3ca42430cfe075999972d2e4c196e608bd747896406a9e3d8860c7f
|