add decode script

This commit is contained in:
Paco 2025-07-17 12:27:32 +02:00
parent 7dd0fe3f85
commit ec97e95ed7
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import sys
def decode_little_endian(hex_input):
hex_values = hex_input.split()
result = []
for hex_val in hex_values:
hex_str = hex_val[2:] # Remove '0x'
bytes_val = bytes.fromhex(hex_str)
reversed_bytes = bytes_val[::-1]
result.append(reversed_bytes.decode('utf-8'))
print(''.join(result))
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py \"0x.... 0x.... ...\"")
sys.exit(1)
input_data = sys.argv[1]
decode_little_endian(input_data)