ReverseBox 0.16.2__tar.gz → 0.16.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/PKG-INFO +2 -1
  2. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/README.md +1 -0
  3. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/ReverseBox.egg-info/PKG-INFO +2 -1
  4. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/ReverseBox.egg-info/SOURCES.txt +1 -0
  5. ReverseBox-0.16.4/reversebox/hash/hash_sdbm.py +24 -0
  6. ReverseBox-0.16.4/reversebox/image/common.py +121 -0
  7. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/setup.py +1 -1
  8. ReverseBox-0.16.2/reversebox/image/common.py +0 -64
  9. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/LICENSE +0 -0
  10. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/ReverseBox.egg-info/dependency_links.txt +0 -0
  11. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/ReverseBox.egg-info/requires.txt +0 -0
  12. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/ReverseBox.egg-info/top_level.txt +0 -0
  13. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/__init__.py +0 -0
  14. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/__init__.py +0 -0
  15. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_adler32.py +0 -0
  16. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_fletcher16.py +0 -0
  17. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_fletcher32.py +0 -0
  18. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_internet_ipv4_header.py +0 -0
  19. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_sum8.py +0 -0
  20. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_sum8_2s_complement.py +0 -0
  21. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_unix_sum_bsd16.py +0 -0
  22. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_unix_sum_sysv.py +0 -0
  23. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/checksum/checksum_xor8.py +0 -0
  24. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/common/__init__.py +0 -0
  25. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/common/common.py +0 -0
  26. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/common/logger.py +0 -0
  27. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/__init__.py +0 -0
  28. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/compression_jcalg1.py +0 -0
  29. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/compression_lzo.py +0 -0
  30. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/compression_mio0.py +0 -0
  31. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/compression_refpack.py +0 -0
  32. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/compression/compression_zlib.py +0 -0
  33. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/__init__.py +0 -0
  34. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_arc.py +0 -0
  35. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_ccitt.py +0 -0
  36. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_dnp.py +0 -0
  37. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_ea_crcf.py +0 -0
  38. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_kermit.py +0 -0
  39. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_modbus.py +0 -0
  40. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc16_sick.py +0 -0
  41. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc32_asobo.py +0 -0
  42. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc32_iso_hdlc.py +0 -0
  43. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc64_asobo.py +0 -0
  44. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc64_go_iso.py +0 -0
  45. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc8.py +0 -0
  46. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/crc/crc_unix_cksum.py +0 -0
  47. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/__init__.py +0 -0
  48. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/encryption_rot13.py +0 -0
  49. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/encryption_xor_basic.py +0 -0
  50. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/encryption_xor_basic_key_guesser.py +0 -0
  51. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/encryption_xor_gianas_return_zda.py +0 -0
  52. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/encryption/encryption_xor_retro64_eco.py +0 -0
  53. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/__init__.py +0 -0
  54. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_djb2.py +0 -0
  55. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_fnv.py +0 -0
  56. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_md2.py +0 -0
  57. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_md5.py +0 -0
  58. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_sha1.py +0 -0
  59. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/hash/hash_sha2.py +0 -0
  60. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/__init__.py +0 -0
  61. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/compression/__init__.py +0 -0
  62. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/compression/compression_gst.py +0 -0
  63. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/file_formats/__init__.py +0 -0
  64. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/file_formats/image_dds.py +0 -0
  65. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/image_decoder.py +0 -0
  66. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/image_encoder.py +0 -0
  67. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/image_formats.py +0 -0
  68. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/palettes/__init__.py +0 -0
  69. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/palettes/palette_random.py +0 -0
  70. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/pillow_wrapper.py +0 -0
  71. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/__init__.py +0 -0
  72. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_3ds.py +0 -0
  73. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_bc.py +0 -0
  74. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_cmpr.py +0 -0
  75. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_gamecube.py +0 -0
  76. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_gst.py +0 -0
  77. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_morton.py +0 -0
  78. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_morton_dreamcast.py +0 -0
  79. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_ps2.py +0 -0
  80. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_psp.py +0 -0
  81. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_psvita.py +0 -0
  82. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/image/swizzling/swizzle_switch.py +0 -0
  83. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/__init__.py +0 -0
  84. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/bytes_handler.py +0 -0
  85. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/bytes_helper_functions.py +0 -0
  86. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/check_file.py +0 -0
  87. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/file_handler.py +0 -0
  88. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/mod_handler.py +0 -0
  89. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/io_files/translation_text_handler.py +0 -0
  90. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/libs/__init__.py +0 -0
  91. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/reversebox/libs/refpack.dll +0 -0
  92. {ReverseBox-0.16.2 → ReverseBox-0.16.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ReverseBox
3
- Version: 0.16.2
3
+ Version: 0.16.4
4
4
  Summary: A set of functions useful in reverse engineering.
5
5
  Home-page: https://github.com/bartlomiejduda/ReverseBox
6
6
  Author: Bartlomiej Duda
@@ -120,6 +120,7 @@ or software researchers).
120
120
  - FNV1-64 ✔️
121
121
  - FNV1A-32 ✔️
122
122
  - FNV1A-64 ✔️
123
+ - SDBM ✔️
123
124
  - SHA-1 ✔️ <span style="color:yellow">(wrapper only)</span>
124
125
  - SHA-2 (256 bits) ✔️ <span style="color:yellow">(wrapper only)</span>
125
126
  - MD2 ✔️ <span style="color:yellow">(wrapper only)</span>
@@ -85,6 +85,7 @@ or software researchers).
85
85
  - FNV1-64 ✔️
86
86
  - FNV1A-32 ✔️
87
87
  - FNV1A-64 ✔️
88
+ - SDBM ✔️
88
89
  - SHA-1 ✔️ <span style="color:yellow">(wrapper only)</span>
89
90
  - SHA-2 (256 bits) ✔️ <span style="color:yellow">(wrapper only)</span>
90
91
  - MD2 ✔️ <span style="color:yellow">(wrapper only)</span>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ReverseBox
3
- Version: 0.16.2
3
+ Version: 0.16.4
4
4
  Summary: A set of functions useful in reverse engineering.
5
5
  Home-page: https://github.com/bartlomiejduda/ReverseBox
6
6
  Author: Bartlomiej Duda
@@ -120,6 +120,7 @@ or software researchers).
120
120
  - FNV1-64 ✔️
121
121
  - FNV1A-32 ✔️
122
122
  - FNV1A-64 ✔️
123
+ - SDBM ✔️
123
124
  - SHA-1 ✔️ <span style="color:yellow">(wrapper only)</span>
124
125
  - SHA-2 (256 bits) ✔️ <span style="color:yellow">(wrapper only)</span>
125
126
  - MD2 ✔️ <span style="color:yellow">(wrapper only)</span>
@@ -51,6 +51,7 @@ reversebox/hash/hash_djb2.py
51
51
  reversebox/hash/hash_fnv.py
52
52
  reversebox/hash/hash_md2.py
53
53
  reversebox/hash/hash_md5.py
54
+ reversebox/hash/hash_sdbm.py
54
55
  reversebox/hash/hash_sha1.py
55
56
  reversebox/hash/hash_sha2.py
56
57
  reversebox/image/__init__.py
@@ -0,0 +1,24 @@
1
+ """
2
+ Copyright © 2024 Bartłomiej Duda
3
+ License: GPL-3.0 License
4
+ """
5
+
6
+
7
+ class SDBMHandler:
8
+ def __init__(self):
9
+ pass
10
+
11
+ # used in Forza Horizon (2012)
12
+ @staticmethod
13
+ def calculate_sdbm_hash_from_string(input_string: str) -> int:
14
+ hash_value = 0
15
+ for char in input_string:
16
+ hash_value = ord(char) + (hash_value << 6) + (hash_value << 16) - hash_value
17
+ return hash_value & 0xFFFFFFFF
18
+
19
+ @staticmethod
20
+ def calculate_sdbm_hash_from_bytes(input_bytes: bytes) -> int:
21
+ hash_value = 0
22
+ for char in input_bytes:
23
+ hash_value = char + (hash_value << 6) + (hash_value << 16) - hash_value
24
+ return hash_value & 0xFFFFFFFF
@@ -0,0 +1,121 @@
1
+ """
2
+ Copyright © 2024 Bartłomiej Duda
3
+ License: GPL-3.0 License
4
+ """
5
+ from reversebox.image.image_formats import ImageFormats
6
+
7
+ # fmt: off
8
+
9
+
10
+ def convert_bpp_to_bytes_per_pixel(input_bpp: int) -> int:
11
+ if input_bpp <= 8:
12
+ return 1
13
+ elif input_bpp <= 16:
14
+ return 2
15
+ elif input_bpp <= 24:
16
+ return 3
17
+ elif input_bpp <= 32:
18
+ return 4
19
+ else:
20
+ raise Exception("Not supported bpp value!")
21
+
22
+
23
+ # The stride is the number of bytes from one row of pixels in memory to the next row of pixels in memory.
24
+ # Stride is also called pitch. If padding bytes are present, the stride is wider than the width of the image.
25
+ # stride = rowbytes = pitch
26
+ def get_stride_value(img_width: int, bpp: int) -> int:
27
+ stride: int = img_width * bpp // 8
28
+ return stride
29
+
30
+
31
+ # img_width = pixels_per_row
32
+ def get_img_width_from_stride(stride: int, bpp: int) -> int:
33
+ img_width = stride * 8 // bpp
34
+ return img_width
35
+
36
+
37
+ # used in N64/WII games
38
+ def get_storage_wh(
39
+ image_width: int, image_height: int, block_width: int, block_height: int
40
+ ) -> tuple:
41
+ image_width = (image_width + block_width - 1) // block_width * block_width
42
+ image_height = (image_height + block_height - 1) // block_height * block_height
43
+ return image_width, image_height
44
+
45
+
46
+ # used in N64/WII games
47
+ def crop_image(
48
+ image_data: bytes,
49
+ width: int,
50
+ height: int,
51
+ bpp: int,
52
+ new_width: int,
53
+ new_height: int,
54
+ ) -> bytes:
55
+ if width == new_width and height == new_height:
56
+ return image_data
57
+
58
+ cropped_image_data = bytearray(new_width * new_height * bpp // 8)
59
+
60
+ lw = min(width, new_width) * bpp // 8
61
+
62
+ for y in range(0, min(height, new_height)):
63
+ dst = y * new_width * bpp // 8
64
+ src = y * width * bpp // 8
65
+ cropped_image_data[dst: dst + lw] = image_data[src: src + lw]
66
+
67
+ return cropped_image_data
68
+
69
+
70
+ def get_bpp_for_image_format(image_format: ImageFormats) -> int:
71
+ if image_format in (ImageFormats.RGB121,
72
+ ImageFormats.N64_CMPR,
73
+ ImageFormats.N64_I4,
74
+ ImageFormats.DXT1):
75
+ return 4
76
+ elif image_format in (ImageFormats.RGBX2222,
77
+ ImageFormats.RGBA2222,
78
+ ImageFormats.RGB121_BYTE,
79
+ ImageFormats.RGB332,
80
+ ImageFormats.BGR332,
81
+ ImageFormats.GRAY8,
82
+ ImageFormats.N64_I8,
83
+ ImageFormats.N64_IA4,
84
+ ImageFormats.DXT3,
85
+ ImageFormats.DXT5):
86
+ return 8
87
+ elif image_format in (ImageFormats.GRAY8A,
88
+ ImageFormats.GRAY16,
89
+ ImageFormats.RGB565,
90
+ ImageFormats.BGR565,
91
+ ImageFormats.RGBX5551,
92
+ ImageFormats.RGBA5551,
93
+ ImageFormats.ARGB4444,
94
+ ImageFormats.RGBA4444,
95
+ ImageFormats.RGBX4444,
96
+ ImageFormats.BGRX4444,
97
+ ImageFormats.XRGB1555,
98
+ ImageFormats.XBGR1555,
99
+ ImageFormats.ARGB1555,
100
+ ImageFormats.ABGR1555,
101
+ ImageFormats.N64_RGB5A3,
102
+ ImageFormats.N64_IA8):
103
+ return 16
104
+ elif image_format in (ImageFormats.RGB888,
105
+ ImageFormats.BGR888,):
106
+ return 24
107
+ elif image_format in (ImageFormats.RGBA8888,
108
+ ImageFormats.BGRA8888,
109
+ ImageFormats.ARGB8888,
110
+ ImageFormats.ABGR8888,
111
+ ImageFormats.XRGB8888,
112
+ ImageFormats.RGBX8888,
113
+ ImageFormats.XBGR8888,
114
+ ImageFormats.BGRX8888,
115
+ ImageFormats.N64_RGBA32):
116
+ return 32
117
+ elif image_format in (ImageFormats.RGB48,
118
+ ImageFormats.BGR48,):
119
+ return 48
120
+ else:
121
+ raise Exception(f"Not supported image format! Format: {image_format}")
@@ -7,7 +7,7 @@ import os
7
7
 
8
8
  import setuptools
9
9
 
10
- VERSION_NUM = "0.16.2"
10
+ VERSION_NUM = "0.16.4"
11
11
 
12
12
 
13
13
  def get_long_description() -> str:
@@ -1,64 +0,0 @@
1
- """
2
- Copyright © 2024 Bartłomiej Duda
3
- License: GPL-3.0 License
4
- """
5
-
6
-
7
- def convert_bpp_to_bytes_per_pixel(input_bpp: int) -> int:
8
- if input_bpp <= 8:
9
- return 1
10
- elif input_bpp <= 16:
11
- return 2
12
- elif input_bpp <= 24:
13
- return 3
14
- elif input_bpp <= 32:
15
- return 4
16
- else:
17
- raise Exception("Not supported bpp value!")
18
-
19
-
20
- # The stride is the number of bytes from one row of pixels in memory to the next row of pixels in memory.
21
- # Stride is also called pitch. If padding bytes are present, the stride is wider than the width of the image.
22
- # stride = rowbytes = pitch
23
- def get_stride_value(img_width: int, bpp: int) -> int:
24
- stride: int = img_width * bpp // 8
25
- return stride
26
-
27
-
28
- # img_width = pixels_per_row
29
- def get_img_width_from_stride(stride: int, bpp: int) -> int:
30
- img_width = stride * 8 // bpp
31
- return img_width
32
-
33
-
34
- # used in N64/WII games
35
- def get_storage_wh(
36
- image_width: int, image_height: int, block_width: int, block_height: int
37
- ) -> tuple:
38
- image_width = (image_width + block_width - 1) // block_width * block_width
39
- image_height = (image_height + block_height - 1) // block_height * block_height
40
- return image_width, image_height
41
-
42
-
43
- # used in N64/WII games
44
- def crop_image(
45
- image_data: bytes,
46
- width: int,
47
- height: int,
48
- bpp: int,
49
- new_width: int,
50
- new_height: int,
51
- ) -> bytes:
52
- if width == new_width and height == new_height:
53
- return image_data
54
-
55
- cropped_image_data = bytearray(new_width * new_height * bpp // 8)
56
-
57
- lw = min(width, new_width) * bpp // 8
58
-
59
- for y in range(0, min(height, new_height)):
60
- dst = y * new_width * bpp // 8
61
- src = y * width * bpp // 8
62
- cropped_image_data[dst : dst + lw] = image_data[src : src + lw]
63
-
64
- return cropped_image_data
File without changes
File without changes