Created
September 7, 2017 12:04
-
-
Save jimmy-ly00/342bf8987db526689dfa374f161b93f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
with open("sample.bmp", "rb") as file: | |
data = file.read() | |
bits = "" | |
for c in data: | |
lsb = str(c & 0x1) | |
bits += lsb | |
bytes = [chr(int(bits[i:i+8], 2)) for i in range(0, len(bits), 8)] | |
out = "".join(bytes) | |
print(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment