https://github.com/bartlomiejduda/ReverseBox
ReverseBox is a Python package with a set of functions useful in reverse engineering.
https://github.com/bartlomiejduda/ReverseBox
checksum cipher compression crc encryption engineering hash modding modding-tools python reverse reverse-engineering reversebox xentax
Last synced: 7 days ago
JSON representation
ReverseBox is a Python package with a set of functions useful in reverse engineering.
- Host: GitHub
- URL: https://github.com/bartlomiejduda/ReverseBox
- Owner: bartlomiejduda
- License: gpl-3.0
- Created: 2022-06-18T22:17:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-19T21:21:14.000Z (about 1 month ago)
- Last Synced: 2026-02-18T04:19:17.733Z (9 days ago)
- Topics: checksum, cipher, compression, crc, encryption, engineering, hash, modding, modding-tools, python, reverse, reverse-engineering, reversebox, xentax
- Language: Python
- Homepage:
- Size: 12.5 MB
- Stars: 48
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-game-file-format-reversing - ReverseBox - Python library for reverse engineering with utilities for checksums, compression, encryption, hashing, and image processing. (π οΈ General Tools / π» Development Libraries)
README
# Info
**ReverseBox** is a Python package with a set of functions
useful in software reverse engineering.
**Why ReverseBox?**
It's designed to help with:
1. Decompressing / compressing data
2. Decrypting / encrypting data
3. Tedious reverse engineering tasks
e.g. testing different checksum algorithms to find the one that was
used in the software or file format
4. Figuring out file formats
5. Parsing data structures
6. Wrapping functions for input/output operations
7. Searching for raw images
**Who should use ReverseBox?**
Mostly developers and reverse engineers (e.g. file format researchers
or software researchers).
# List of functionalities
* Checksum
- Adler32 βοΈ
- Cocos2d PVR βοΈ
- Fletcher16 βοΈ
- Fletcher32 βοΈ
- Internet Checksum / IPv4 header checksum βοΈ
- Sum8 βοΈ
- Sum8 2s Complement βοΈ
- Unix Sum BSD16 βοΈ
- Unix Sum SYSV βοΈ
- Xor8 βοΈ
* CRC
- CRC-8 βοΈ
- CRC-8/CDMA2000 βοΈ
- CRC-8/DARC βοΈ (wrapper only)
- CRC-16 (ARC) βοΈ
- CRC-16 (Modbus) βοΈ
- CRC-16 (Sick) βοΈ
- CRC-16 (DNP) βοΈ
- CRC-16 (EA CRCF) βοΈ
- CRC-16-CCITT (XModem) βοΈ
- CRC-16-CCITT (0xFFFF) βοΈ
- CRC-16-CCITT (0x1D0F) βοΈ
- CRC-16-CCITT (Kermit) βοΈ
- CRC-32/CKSUM (Unix cksum) βοΈ
- CRC-32 (ISO/HDLC) βοΈ
- CRC-32 (Asobo) βοΈ
- CRC-64 (Asobo) βοΈ
- CRC-64/GO-ISO βοΈ (wrapper only)
* Compression
- Asobo (TODO) β
- BZE/BZZ (TODO) β
- BZIP2 βοΈ (wrapper only)
- GZIP (TODO) β
- JCALG1 (TODO) β
- LZ4 βοΈ (wrapper only)
- LZMA βοΈ (wrapper only)
- LZO / LZO1X βοΈ (wrapper only)
- LZSS (TODO) β
- MIO0 βοΈ
- NitroSDK (TODO) β
- Oodle (TODO) β
- Refpack (EA Games) βοΈ (wrapper only)
- RNC (TODO) β
- ZLIB βοΈ (wrapper only)
- PS2 GS Texture Compression βοΈ
- RLE TGA βοΈ
- RLE TGA (reversed condition) βοΈ
- PackBits (Macintosh RLE) βοΈ
- (game-specific) Re:Tiyoruga DAT compression βοΈ
- (game-specific) Intelligent Games Custom Huffman βοΈ
- (game-specific) Executioners RLE βοΈ
- (game-specific) Emergency RLE βοΈ
- (game-specific) Neversoft RLE βοΈ
- (game-specific) Tzar RLE βοΈ
- (game-specific) Leapster RLE βοΈ
* Encryption
- AES (TODO) β
- DES (TODO) β
- Lucifer / DTD-1 (TODO) β
- ROT13 βοΈ
- XOR Cipher (Basic) βοΈ
- XOR Cipher (Basic) Guesser βοΈ
- Hatch Engine Encryption βοΈ
- (game-specific) XOR Cipher (Retro64 ECO) βοΈ
- (game-specific) XOR Cipher (Gianaβs Return ZDA) βοΈ
* Hash
- Additive Hash βοΈ
- AP βοΈ
- DJB2 βοΈ
- RX3 βοΈ
- FNV0-32 βοΈ
- FNV0-64 βοΈ
- FNV1-32 βοΈ
- FNV1-64 βοΈ
- FNV1A-32 βοΈ
- FNV1A-64 βοΈ
- Jenkins one-at-a-time βοΈ
- SDBM βοΈ
- SHA-1 βοΈ (wrapper only)
- SHA-2 (256 bits) βοΈ (wrapper only)
- MD2 βοΈ (wrapper only)
- MD5 βοΈ (wrapper only)
- Murmur3 βοΈ (wrapper only)
- (game-specific) Hercules (TODO) β
- (game-specific) E-racer (TODO) β
- (game-specific) Pivotal Games DAT Hash βοΈ
* Image
- 3DS Swizzling/Twiddling βοΈ
- CMPR Swizzling/Twiddling βοΈ
- PS2 Swizzling/Twiddling βοΈ
- PS2 Palette Swizzling/Twiddling βοΈ
- PS4 Swizzling/Twiddling βοΈ
- PS5 Swizzling/Twiddling βοΈ
- PSP Swizzling/Twiddling βοΈ
- PS Vita Swizzling/Twiddling βοΈ
- XBOX 360 Swizzling/Twiddling βοΈ
- GameCube/WII Swizzling/Twiddling βοΈ
- Switch Swizzling/Twiddling βοΈ
- WII U Swizzling/Twiddling βοΈ
- XBOX/PS3 Swizzling/Twiddling (Morton Order) βοΈ
- Dreamcast Swizzling/Twiddling (Morton Order) βοΈ
- BC Swizzling/Twiddling βοΈ
- PS2 GS Texture Swizzling/Twiddling βοΈ
- Generating mipmaps βοΈ
- Decoding and encoding images with pixel formats
mentioned in the following table:
| Pixel Format | Decode support | Encode support |
|------------------------|---------------------|---------------------|
| RGB121 | βοΈ | β |
| ALPHA4 | βοΈ | β |
| ALPHA4_17X | βοΈ | βοΈ |
| RGB121_BYTE | βοΈ | β |
| RGBA2222 | βοΈ | β |
| RGBX2222 | βοΈ | β |
| GRAY8 | βοΈ | β |
| ALPHA8 | βοΈ | β |
| ALPHA8_17X | βοΈ | β |
| LA44 | βοΈ | β |
| RGBX332 (RGB8) | βοΈ | β |
| BGRX332 (BGR8) | βοΈ | β |
| RGB565 | βοΈ | βοΈ |
| BGR565 | βοΈ | βοΈ |
| RGBX5551 | βοΈ | βοΈ |
| RGBT5551 | βοΈ | βοΈ |
| BGRT5551 | βοΈ | β |
| RGBA5551 | βοΈ | βοΈ |
| BGRA5551 | βοΈ | βοΈ |
| BGRA5551_TZAR | βοΈ | β |
| BGRX5551 | βοΈ | β |
| RGBX6666 | βοΈ | β |
| RGBA6666 | βοΈ | β |
| RGB888 (RGB24) | βοΈ | βοΈ |
| BGR888 (BGR24) | βοΈ | βοΈ |
| ARGB4444 | βοΈ | β |
| RGBA4444 | βοΈ | β |
| ABGR4444 | βοΈ | βοΈ |
| XBGR4444 | βοΈ | β |
| RGBX4444 | βοΈ | βοΈ |
| BGRA4444 | βοΈ | βοΈ |
| BGRA4444_LEAPSTER | βοΈ | β |
| BGRX4444 | βοΈ | β |
| XRGB1555 | βοΈ | β |
| ARGB1555 | βοΈ | β |
| ABGR1555 | βοΈ | β |
| XBGR1555 | βοΈ | β |
| ARGB8888 | βοΈ | βοΈ |
| ABGR8888 | βοΈ | β |
| RGBA8888 | βοΈ | βοΈ |
| BGRA8888 | βοΈ | βοΈ |
| XRGB8888 | βοΈ | β |
| RGBX8888 | βοΈ | β |
| XBGR8888 | βοΈ | β |
| BGRX8888 | βοΈ | β |
| BGRT8888 | βοΈ | β |
| BGRA8888_TZAR | βοΈ | β |
| RGB48 | βοΈ | β |
| BGR48 | βοΈ | β |
| PAL4 | βοΈ | βοΈ |
| PAL8 | βοΈ | βοΈ |
| PAL8_TZAR | βοΈ | β |
| PAL16 | βοΈ | β |
| PAL32 | βοΈ | β |
| PAL_I8A8 | βοΈ | β |
| N64_RGB5A3 | βοΈ | β |
| N64_BGR5A3 | βοΈ | βοΈ |
| N64_I4 / GRAY4 | βοΈ | βοΈ |
| N64_I8 / GRAY8 | βοΈ | βοΈ |
| N64_IA4 | βοΈ | βοΈ |
| N64_IA8 | βοΈ | βοΈ |
| N64_RGBA32 | βοΈ | β |
| N64_CMPR | βοΈ | βοΈ |
| BC1/DXT1 | βοΈ | βοΈ |
| PSP_DXT1 | βοΈ | β |
| DXT2 | βοΈ | β |
| BC2/DXT3 | βοΈ | βοΈ |
| PSP_DXT3 | βοΈ | β |
| DXT4 | βοΈ | βοΈ |
| BC3/DXT5 | βοΈ | βοΈ |
| PSP_DXT5 | βοΈ | β |
| BC4 | βοΈ | βοΈ |
| BC5 | βοΈ | βοΈ |
| BC6 | βοΈ | βοΈ |
| BC7 | βοΈ | βοΈ |
| PVRTCI_2bpp_RGB | βοΈ | βοΈ |
| PVRTCI_2bpp_RGBA | βοΈ | βοΈ |
| PVRTCI_4bpp_RGB | βοΈ | βοΈ |
| PVRTCI_4bpp_RGBA | βοΈ | βοΈ |
| PVRTCII_2bpp | βοΈ | βοΈ |
| PVRTCII_4bpp | βοΈ | βοΈ |
| ETC1 | βοΈ | βοΈ |
| BW1bpp | βοΈ | βοΈ |
| SharedExponentR9G9B9E5 | βοΈ | βοΈ |
| RGBG8888 | βοΈ | βοΈ |
| GRGB8888 | βοΈ | βοΈ |
| ETC2_RGB | βοΈ | βοΈ |
| ETC2_RGBA | βοΈ | βοΈ |
| ETC2_RGB_A1 | βοΈ | βοΈ |
| EAC_R11 | βοΈ | βοΈ |
| EAC_RG11 | βοΈ | βοΈ |
| ASTC_4x4 | βοΈ | βοΈ |
| ASTC_5x4 | βοΈ | βοΈ |
| ASTC_5x5 | βοΈ | βοΈ |
| ASTC_6x5 | βοΈ | βοΈ |
| ASTC_6x6 | βοΈ | βοΈ |
| ASTC_8x5 | βοΈ | βοΈ |
| ASTC_8x6 | βοΈ | βοΈ |
| ASTC_8x8 | βοΈ | βοΈ |
| ASTC_10x5 | βοΈ | βοΈ |
| ASTC_10x6 | βοΈ | βοΈ |
| ASTC_10x8 | βοΈ | βοΈ |
| ASTC_10x10 | βοΈ | βοΈ |
| ASTC_12x10 | βοΈ | βοΈ |
| ASTC_12x12 | βοΈ | βοΈ |
| ASTC_3x3x3 | βοΈ | βοΈ |
| ASTC_4x3x3 | βοΈ | βοΈ |
| ASTC_4x4x3 | βοΈ | βοΈ |
| ASTC_4x4x4 | βοΈ | βοΈ |
| ASTC_5x4x4 | βοΈ | βοΈ |
| ASTC_5x5x4 | βοΈ | βοΈ |
| ASTC_5x5x5 | βοΈ | βοΈ |
| ASTC_6x5x5 | βοΈ | βοΈ |
| ASTC_6x6x5 | βοΈ | βοΈ |
| ASTC_6x6x6 | βοΈ | βοΈ |
| BASISU_ETC1S | βοΈ | βοΈ |
| BASISU_UASTC | βοΈ | βοΈ |
| RGBM | βοΈ | βοΈ |
| RGBD | βοΈ | βοΈ |
| GST121 | βοΈ | β |
| GST221 | βοΈ | β |
| GST421 | βοΈ | β |
| GST821 | βοΈ | β |
| GST122 | βοΈ | β |
| GST222 | βοΈ | β |
| GST422 | βοΈ | β |
| GST822 | βοΈ | β |
| YUY2 | βοΈ | β |
| NV12 | βοΈ | β |
| NV21 | βοΈ | β |
| UYVY | βοΈ | β |
| YUV444P | βοΈ | β |
| YUV410P | βοΈ | β |
| YUV420P | βοΈ | β |
| YUV422P | βοΈ | β |
| YUV411P | βοΈ | β |
| UYYVYY411 | βοΈ | β |
| YUV440P | βοΈ | β |
| YUVA420P | βοΈ | β |
| AYUV | βοΈ | β |
| GRAY8A (LA88) | βοΈ | β |
| GRAY16 | βοΈ | β |
| RG88 | βοΈ | β |
| R8 | βοΈ | β |
| G8 | βοΈ | β |
| B8 | βοΈ | β |
| R16 | βοΈ | β |
| G16 | βοΈ | β |
| B16 | βοΈ | β |
| R32 | βοΈ | β |
| G32 | βοΈ | β |
| B32 | βοΈ | β |
| BUMPMAP_SR | βοΈ | β |
* IO
- File Reader βοΈ
- File Writer βοΈ
- Bytes Handler βοΈ
- Translation Text Handler βοΈ
- Mod Handler βοΈ
- File extension checking βοΈ
- Padding calculation βοΈ
- File size checking βοΈ
# Checksum calculation - example
// CRC32 calculation
```
from reversebox.crc import crc32_iso_hdlc
from reversebox.common import common
test_data = b'123456789'
crc32_handler = crc32_iso_hdlc.CRC32Handler()
crc32 = crc32_handler.calculate_crc32(test_data)
print("CRC32_INT: ", crc32)
print("CRC32_STR: ", common.convert_int_to_hex_string(crc32))
```
// CRC32 output
```
CRC32_INT: 3421780262
CRC32_STR: 0xCBF43926
```
# XOR encryption - example
// XOR Cipher (Basic)
```
from reversebox.encryption.encryption_xor_basic import xor_cipher_basic
test_data = b'abcd'
test_key = b'\x3D'
xor_result = xor_cipher_basic(test_data, test_key)
print(xor_result)
```
// XOR Cipher output
```
b'\\_^Y'
```
# File Handler - example
// File reading
```
import os
from reversebox.io_files.file_handler import FileHandler
file_path = os.path.join(os.path.dirname(__file__), "file.bin")
file_reader = FileHandler(file_path, "rb")
file_reader.open()
value = file_reader.read_str(4, "utf8")
print(value)
```
// File Reader Output
```
ABCD
```
# Hash calculation - example
// SHA-1 calculation
```
from reversebox.hash.hash_sha1 import SHA1Handler
test_data = b'abcd'
sha1_handler = SHA1Handler()
sha1 = sha1_handler.calculate_sha1_hash(test_data)
print("SHA-1 hash: ", sha1)
```
// SHA-1 Output
```
SHA-1 hash: b'\x81\xfe\x8b\xfe\x87Wl>\xcb"Bo\x8eW\x84s\x82\x91z\xcf'
```
# Image decoding - example
// DXT1 compressed image decoding
```
from reversebox.image.image_decoder import ImageDecoder
from reversebox.image.image_formats import ImageFormats
from reversebox.image.pillow_wrapper import PillowWrapper
def show_img():
with open("image_data_dxt1_64x64.bin", "rb") as f:
image_data = f.read()
img_width: int = 64
img_height: int = 64
decoder = ImageDecoder()
wrapper = PillowWrapper()
converted_data: bytes = decoder.decode_compressed_image(image_data, img_width, img_height, ImageFormats.BC1_DXT1)
pil_image = wrapper.get_pillow_image_from_rgba8888_data(converted_data, img_width, img_height)
pil_image.show()
if __name__ == '__main__':
show_img()
```
# More Examples
Need more examples?
Check out list of tools written using ReverseBox:
- [Giana's Return ZDA Tool](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/Gianas%20Return/Gianas_Return_ZDA_Tool.py)
- [ObsCure 2 HVP Extractor](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/ObsCure%202/ObsCure%202%20HVP%20Tools/Obscure_2_hvp_extractor.py)
- [Tail Concerto Translation Tools](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/Tail%20Concerto/Tail%20Concerto%20Tools)
- [EA Graphics Manager](https://github.com/bartlomiejduda/EA-Graphics-Manager)
- [Acclaim TRE Tool](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/Acclaim/Acclaim_TRE_Tool)
- [F-Zero X TEX Tool](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/F-Zero%20X/TEX%20Tool)
- [ImageHeat](https://github.com/bartlomiejduda/ImageHeat)
- [Hatch Engine Archive Tool](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/Hatch%20Engine/Hatch%20Engine%20Archive%20Tool)
- [ReverseBox Demo](https://github.com/bartlomiejduda/Tools/tree/master/ReverseBox_Demo)
- [Super Galdelic Hour .egg texture extractor/converter](https://gist.github.com/boringhexi/e3f2e5ad98c39cdafa4913d7db23f81d)
- and more...
# Badges





