> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/forensics/binary/binary_digits.md).

# binary\_digits

for recon, i did

<img src="https://github.com/user-attachments/assets/cde7279e-a653-4d8e-9a38-cd876defffb0" alt="image" height="350" width="1125">

after converting from binary to hex, the first few bits looks suspicious

The Magic Number

The hexadecimal signature for a JPEG is: FF D8 FF E0

Sometimes, depending on the specific type of JPEG (like a digital camera's EXIF file), the fourth byte might change, but it must start with FF D8.

i fixed that,

<img src="https://github.com/user-attachments/assets/9b6da3d1-7dbe-41ab-889d-298b4330b8b7" alt="image" height="486" width="672">

&#x20;

<img src="https://github.com/user-attachments/assets/4f2e4d03-302f-4f58-b6ab-8290c1cba86c" alt="image" height="350" width="1125">

$ python3 -c "python3 -c "with open('digits.bin','r') as f: data=f.read().strip(); print('Length:', len(data)); n=int(data, 2); open('out.jpg', 'wb').write(n.to\_bytes((len(data)+7)//8, 'big'))" Length: 71200

<img src="https://github.com/user-attachments/assets/19186ba7-1dcc-4db7-acba-bcd6bacd9d40" alt="image" height="651" width="1115">
