Created
January 18, 2018 22:13
-
-
Save jabbalaci/c75d21405dfac35e06956540682be0c0 to your computer and use it in GitHub Desktop.
Extract text that is hidden in an image.
This file contains 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 python3 | |
""" | |
Extract data from http://users.atw.hu/std66/egyetem/monika.png . | |
It's from the game "Doki Doki Literature Club". | |
Tamás Sinku showed me this problem. He also described the | |
solution: take the middle of the image. A black pixel means 0, | |
while a white pixel means 1. Read it byte by byte and convert | |
it to text. You get a BASE64 string with some '\0' characters | |
at the end. Decode it to get the solution. | |
Laszlo Szathmary, 2018 | |
jabba.laci@gmail.com | |
""" | |
import base64 | |
DATA = """ | |
1010111011001101101110011000101010110110101101111001001110001001100110 | |
1110101100101111011001000010100101101010001011100110000110101101101011 | |
1000110011101001001110101111100010001100111110110100101110111010111010 | |
0100001000101010110011100101101100101010100111100111101011100011000111 | |
1001100010100110101001111011010110010011101101101011011110010011100010 | |
0110011011101010111100011110110001101111001001100011001111101101001010 | |
1100101011001011110110010101101001101010100011001011100100011001101110 | |
1111001100101110001010101100111001010010010100100110001010011011001101 | |
1011100110001010101101011100110010101110100110001001110011001101101010 | |
0110010011101101101011011110010011100010011001101110101100110010111011 | |
0001101111001001100011001111101101001010111010010001101010011100111110 | |
1101101011101010010100100110001001111011001101110010101000100110011011 | |
1000011010111101110010101001110111001100101010101001000110011100100100 | |
1010101010100110001001101110111000100101111001001110011100100100101010 | |
1010100010101011011010111001100100111001001110100110101010001001100010 | |
0010101011001110010110110010101100101010011101110011001010101010011000 | |
1010011011001101101110011000101010110110101110001010110110010011101001 | |
0110010010100100111000101010011110101001111010110110010011100111011011 | |
0111100101001001100010011110101110001010100110010111100111001001011010 | |
1111011000101110100101101011001100101110110001101111001001100011001111 | |
1011010010101000101010001100011011001110101101011100110010100101100100 | |
1110110110101110001011010110010011101001011010100011001011100110001001 | |
1011110011011011100111001111101001101100110110010111100011111001110110 | |
0100101001110010011000101001011001001011000110100001101011011010111000 | |
1011101010011000100110111100110110010111100011111001110110111000101010 | |
1010011000100111011001001011000110110011001011001110111100101111011000 | |
0110100111101010100010011011100100001001101110111011110001111011000110 | |
1111001001100011001111101101001010110010101100101111011001000110011011 | |
1010100010101001100001011001110010000110101111011011010110110110101101 | |
1110110001100100001001110111001100101010011000110010100101101111001100 | |
1011100010101011001110010010100100111000101010011011101101111011010110 | |
0010011010010110110111101010011001010110100101101011001011110110001011 | |
1001101010100111101100011001001110011101101110001010011010001100101101 | |
1010111000110001101000011010110110101101111011000110001001100111011010 | |
1000101010011100111110011110101110001001001110001010101001011000011011 | |
0010111001100010101001101010001100111110001010101100111001011011001010 | |
1000101110011010101011001011110110001010101001101010100011001110100100 | |
1110110110101110001001001110000101101100111001011011001011100010101010 | |
0110101010001011000111001111100110111010100010111001100011001001110110 | |
1101111001010010001100101101101011011110101101100100001010011010100111 | |
1010111010010001100111001000011010111101100001011001101110110111101010 | |
0110001000100111101010100010101110100010101011011010111001100100111000 | |
1001100110111010110010111101100010011010011010010001101001011000111110 | |
0111011100110010101001100001011001110110110111100101001001100010100110 | |
1010100010000111100001101010010110101000101110011001010010011010101011 | |
0010111101100011011001110110010010110001101100110010110110101110001100 | |
1110110010101011011010111000110010101001011110011101101010001010101010 | |
0010101011011010111001101100011000100110011100100100011011010111001010 | |
1011001110011000110011111011010010111011101011101000111110111101100111 | |
0110010001100100111100110010100110101001111001010010001010101100111001 | |
0110110010101011010110110101110011011100111110011000101001011100110010 | |
1010011001001110011100110011001011000110001111100111011001001010011100 | |
1001100010011110101010001010011010011000100110101010100011000110110011 | |
1010110110101101111001101110010011100111001001001010101010100110001010 | |
0110101010001011010110001100101001011010110010111101110011111001110110 | |
0001101011110110001000100110111010011110101110100110001010011010101100 | |
1011110110000101100110111011100011000110100010001011011010110111101011 | |
0110001001101101101011011110101101100100001001111010100111101100101000 | |
1100101101101011011110010011100010011001101110101100101111011100110010 | |
0111011100110010101001100011001010010110111100101111011001000010100110 | |
1010011110100101100100111011011010111000101011011000100110011101100100 | |
1010101010100110001001111010100111101011101001100010100110100100011001 | |
0100100110001001110110010010110001101100110010110011100110001100111110 | |
1101001011101110101110100011111011010110110110101110001100111010010011 | |
1010011010101000110010111000110010110110101110101001010010011000100111 | |
1011001101110010101000100110011011100001101011110111001010100111011100 | |
1100101010101001000110011100100100101010101010011000100111011001001011 | |
0001101100111110110011101111001011110110001100100111101010100010001011 | |
1001001110110011100101101100101110001010101001011010011110100101100011 | |
1110011101101111001000100010011000100111011100110010110110100110001010 | |
0110101010001100101011001010100110111011100010010111100011111001110110 | |
0100101001110010001010101100111001011011001010100101101010010110101000 | |
1011000110010111100110111010011110110001100100111011011010110111100100 | |
1110001001100110111010110010011011110011011010010110101100101111011001 | |
0111100111011011011110110101100100111010011010101000101011011100101010 | |
1101101011100010010111100100111001110110110111101111011001001110100101 | |
1011110010111101100010111010010110101100101111011000010110011101100001 | |
1010111101100010111001101110101000101100011001000010110011100110001100 | |
1111101101001011101110101110100011111011010110110110101101111011000110 | |
0100001001110111001100101010011000110010100101101111001011110110000110 | |
1010010110101000101110011000110010011101101101111001010010011000100110 | |
1110111000100101111001011110011101100100101000110010011000100110101010 | |
1000110001101100111010110110101110001010010110001001100111001001011010 | |
1111011100111110011110101110001011100111001111101100111001011010111101 | |
1011100010011101110011001011011010011000101001011010011110100101100100 | |
1110011100100100011001001111001111100111101011100010010011100010101010 | |
0101100001101011110111001010100111011100110010101010100100011001101110 | |
0100101010101010011000101001011011100011000110100010101010010110101100 | |
1100101110011000101010001010100011000110110011101011010111001100101101 | |
0110010011101101101011011110110101100100111010011010101000100001111000 | |
1100100110101010110010111101100011001001111010101000100010111001001110 | |
1101101011100010111010100110001010010110010001101101011000111110100101 | |
1010100011001010100101001011011010110111101011011000100110110110101110 | |
0011001110100100111011001110010110101111011010101110011101100001101100 | |
1011100010101011001110010001101011011001000010100110101010001100101010 | |
0011011011011010110111100100111000100110011011101011001100101110011000 | |
1010101011001101110001111001100010011101101001111010100110010101100111 | |
1010111100110010111011000110111100100110001100111110110100101011001010 | |
1100101111011100111110011110101110001001001110001010100111101000011011 | |
0010111000101010110011100100101100111010001001100111001001001010101010 | |
1001100010011011101110001001011110010111100111011001011010111101100101 | |
1110011101100100011001001111001111100111101011100010010011100010101010 | |
0101100001101011110110010011100111011011011110110001100100111011001110 | |
0101101100101110001010101011001010110010111101100001101010010110101000 | |
1011100110001100100111011011011110010100100110001010010110111000110001 | |
1010001010101101011100110010101110100110001001101111001101101110011000 | |
1010100110111011110010111101100011111001101110111100101111011100111110 | |
0111011000011010111101100101111001110110111000100010001001100010100110 | |
1001001010101010100110001010010110010010110001101000011010110110101110 | |
0011001010100010011001101110111000100101111000111110011101100100101001 | |
1100100010101011101110101110100100001011000110111100100101101100101110 | |
0010101011001110011000110011111011010010111011101011101000111110111001 | |
1001101110010010101010011000011010011010101010001100011010001010101001 | |
0110101100101111011001001110011101101101111011000110010011101101101011 | |
1000100100111000010110110110101110001010110110010011101001101010100010 | |
1011101000101010111011101011101001000010110001101111001001010011001110 | |
1001011110011010101010001011010110010011101101101011011110010011100010 | |
0110011011101011001011110110010111100111011011011110110101100100111010 | |
0110101010001010110111001010101101101011100010001011100010101001110111 | |
0011001001110010011000100110111011100010010111100101111001101110111100 | |
1100101110011000101011001010110010011011100010111011011010110111101100 | |
0111001110100111001001001010101010100110001001101010101000110001101100 | |
1110101101101011100010101101100010011011001110111100101111011001011110 | |
1001101100110010101101110011101010011010101000100001111000110010011010 | |
1010110011001011101100011011110010011000110011111011010010101110100100 | |
0110101001110011111011001110010110110010111000101010011110101001111010 | |
1110100110001010010110111000110001101001001110011100110011011100101110 | |
0100011001101110111100101111011001000010100110101001111010010110010011 | |
1011011010110111101011011000100110110110101110001011010110010011101101 | |
1010110111101011011001000010100110101001111010111010011000100110111100 | |
1101101110011100101010110011101111001011110110000110100111101010100010 | |
0110111001000010011011101110111100011110110001101111001001100011001111 | |
1011010010101001110011011010100110001100100111011011110011001011100010 | |
1010110011100100011010110110010000101001011010011110110101100100111011 | |
0101110011001011001010011000101001101010110010111101100011001001110111 | |
0011001010111010011000100111011100110110100110100110001001110011001100 | |
1010110111001110101001011001001010100110100110001010110010101100101111 | |
0110010100100111011100110111001011100100011001101110111100101111011100 | |
1110100111011001001010101101100100111001110010010001101100011100111110 | |
1001101010100011001010100101001011001110010110101111011011010110110110 | |
1011100010101101100010011001110110010110100110111100111110110110101110 | |
0010001011100010101001110111001100100111001001100010011110101010001010 | |
0110100110001001111010100111101011101001000110011100100001101011110110 | |
0100111001101110010010101010011000101010110110101101111011110110001001 | |
1001110011001100101100011000111110100110100100101000011110010011101101 | |
1010111000101001011000100110011100100101101011110110001011101001011010 | |
1100101111011100111110011101100001101011110111001110100111011001001010 | |
1011011001001110011100100100011011000111001111101001101010100011001010 | |
1001010010110110101110001001001111001111101100111001100011001111101101 | |
0010111011101011101000111110111100100110111010011110101110100110001010 | |
1100101011001011110110001101100111011001001011000110110011001011011010 | |
1101111010110110010000101001101010011110101110100110001001101110111000 | |
1001011110001111100111001000011010111101100011111001110011001101110010 | |
1110010001100110111011110010111101100010111001101010101100101111011000 | |
1001100111011001001010000111110010101011011010110111101100011100111110 | |
0111011100110010110101110010101011001110011000110011111011010010111011 | |
1010111010001111101101011011011010111000101100011001011110011101100101 | |
1010111101100001011010010110101000101010101001100010011011101110001001 | |
0111100101111001101110111100101111011000101010011101110011001001110010 | |
0010101011011010111001101101011001001110100110101010001000011110001100 | |
1001101010101100101111011001010110011101101110001010100110010111100111 | |
0010010010100001111100101010110011100110001100111110110100101110111010 | |
1110100011111011110110011101100100101010111010011000101011001010110010 | |
1111011100111110011110101110001001001110001010100111101000011010111101 | |
1001001110011011100100101010100110000110100110101010100011000110100010 | |
1010100101101011001011110110010011100111011011011110110001100100111011 | |
0110101110001001011110010111100111001000011010111101100100001010011010 | |
1010001010111010011000100110111011100010010111100100111011011010110111 | |
1011000110010111100111011010100010101010100110001001111011001101100100 | |
1110001010101001011011110010111101100010011010010110010110101111011001 | |
0011100110101011011110111101100100111001110010010010100100111001001110 | |
0111011001001010110001100100111011001110010110101111011010101110011101 | |
1100110111001110100100111011011010111000100010111000111110011101100100 | |
1010101110100110001001110111001101101001101001100010100101101110001010 | |
1001100011101010011010101100101111011100110110011011101011001100101110 | |
1100011011110010011000110011111011010010101100101001111010111010010001 | |
1001110010000110101111011100111110011110101110001010101010011000101010 | |
0110111000100101111000111110011100100100101010111010011000101011011010 | |
0111100100111001001110110011101111001011110110000110100111101010100010 | |
0110111001000010011011101110111100011110110001101111001001100011001111 | |
1011010010101110101010001100101011001010100110111100110110111001110010 | |
1010110011100101101100101110001010101011001010110010111101100101011001 | |
1101110011001010100110001100101001011011110010111101100101101010010110 | |
1011001011110111001111100111011100110010101101100101111001110110111000 | |
1000011111001010101101101011011110011011100001101001110111001101110010 | |
1010010001101101101011100010111001100101101001110111001100101010011100 | |
1111101101101011011110101101100100001001111010100111101100101000101010 | |
1101101011101010110101110011101001101110111100101111011011010110110110 | |
1011011110110101100100111010011010101000100001111000110010011010101011 | |
0010111101110011111001111010111000100100111000101010011110100001101011 | |
1101110010101001110111001100101010101001100010011101101010001001001110 | |
0100011001111010110111101011101001100010100110100100101010101010011000 | |
1010011010101000101101011000110010100101101011001011110111001111100111 | |
0110000110101111011001010010011101100001101011110110000101100111011100 | |
1101110011101001001110011011101110001001011110001111100111011001001010 | |
0111001000101010111011101011101001000010110001101111001001010010010100 | |
1001100010011011101110001001011110001111100111011001001010001100100110 | |
0010011010101010001100011011001110101101101011100011001110100011111010 | |
0101110011011001011111001111101101101011100010110101100100111011011010 | |
1110001011100110010110100111011011100010101010100110001001101110111000 | |
1100011110011000101001011100110111000111100110001010011010010010101110 | |
0110010101100111101000011011001011100010101011001110010010110001101000 | |
0110101101101011100010010111100010011001101111001101101010011100110110 | |
1001011010011110110110100110001001101010101000110001101100111010110110 | |
1011011110011011100101111001110110010001101011101001100010011011101110 | |
0011000111100110001001110010110111101010011100111110110110101110001001 | |
0011110011111011001110010110110010111000101010111011101011101001000010 | |
1100011011110010010110110010111000101010110011100100111010110110001001 | |
1011011010111000100110111000100110110110101110001011010110010111101001 | |
1011001101100011001001100010100110101010001100101010010100101101101011 | |
0111101011011001001110011101101110001000100010011000100110111011100010 | |
0101111001001110011101101011001011110111001100100111101011100010111001 | |
1100111110110101110011001011001010011000101001011100110111000110100011 | |
1110011101100100101001110010011000100110111011100011000111100110001001 | |
1110101110001011100110001000100111001011100010101001100010101011001110 | |
0110001100111110110100101110111010111010001111101101011010010110010110 | |
1011110111001111100111101011100010101001110010101011011010111000100010 | |
1110001010100111011100110010011100100110001010011010101000100101111001 | |
0011101001101010100010101110100110001001110111001101101001101001100010 | |
0110111011100010010011100010111010010110101100100010001001100010011011 | |
1011100010010111100100111001110110010110101111011100111110011110101110 | |
0010101001110010101011011010110111101100011001000010011101110011001010 | |
1001100011001010010110111100101111011001011010100101101011001011110110 | |
0101111010011010010010100001111001001110110110101101111010110110001001 | |
1011011010111000101110011100110110011101110011011001001110010100101101 | |
1010111000100100111100111110110011100110001100111110110100101110111010 | |
1110100011111010101010011110101110001010100111001010101101101011011110 | |
1100011001000010011101110011001010100110001100101001011011110011001011 | |
1000101010110011100100101001001110010010101101101011011110101101100100 | |
0010100101101001111001010010011000100111001001001010101001100010111010 | |
0101101010001100111010010110101001011010011110110110100110001001101110 | |
1110001001011110010011100111101010011110110110100110001001101110111000 | |
1001001110001011101001011010110010111101110011001001111010100111101011 | |
0110010000101101101011100011001110100100111011011010111000100100111000 | |
1010101101101011011110101101100100001010010110101100101111011000100110 | |
0110111011100010010111100100111001110010010110101111011100110010011101 | |
1100110010110101100011001010010110110111101100101000101010110011100101 | |
1011001010110011111001111010111000101010011100101010110110101101111011 | |
0001100100001001110111001100101010011000110010100101101111001011110110 | |
0001101010010110101000110011101001001110011101101010001011010110010011 | |
1001110010010110101111011100110010011110101110001011100111001111101101 | |
1010111010100101001001100010011011101110001010100110001100100111011011 | |
1100101111011100111110011110101110001010100110001011101100111001100011 | |
0011111011010010111011101011101000111110100101101001011010100010111001 | |
1001000010110011100101101011110110110101101101101011011110110101100100 | |
1110100110101010001000011110001100100110101010110010111101110011111001 | |
1110101110001001001110001010100111101000011010111101110011111001111010 | |
1110001001001110000101101101101011100011001110100011111010010111001101 | |
1001011111001111101101101011100010110101100100111011011010110111101111 | |
0110001001100111001100110010110001100011111010011010010010100001111001 | |
0011101100111001011010111101101111001001101110100111101011101001100010 | |
0111101010011110101110100100011001110010000110101111011100111010011100 | |
1011110010111101110011111001110110000110101111011100101010011101110011 | |
0010101010100010101011101110101110100100001011000110111100100101001001 | |
0100100100011001110110101100101111011000010110011101110011001011010110 | |
0001101001101010101100101111011001001010011101110011001011011010011000 | |
1010011010101000100001111100110010100110101001111001001110000101101101 | |
1010111000101101011001001110011110101010001100101010010001101100111001 | |
0110110010111000101010011010101010001100011011001110101101101011100010 | |
0010111000101010011101110011001001110010001010101100111001011011001011 | |
1011000110111100100110001100111110110100101100111001011011001011100010 | |
1010111011101011101001000010110001101111001001010011001010100100111001 | |
1011100100101010100110000110101101101011100011001110100011111001110110 | |
0100101010111010001010101101101011101010010100100110001001111011001101 | |
1100101010001001100110111000011010111101110011111001111010111000101110 | |
0111001111101101011100110010110010100110001001101111001100101101011000 | |
1001100111011001001010011100100010101011101110101110100100001011000110 | |
1111001001001110101101100100001001111010100111101100101001100010011110 | |
1010011110110010100110001001110110100111100101001001100010011100110011 | |
0010101101100010011001110010010001100101001000101010110110101110101001 | |
0011110011111011010111001100101100101001100010011011101110001001001110 | |
0010111010010110101100101111011100111110011101100001101011110110010110 | |
1010010110101100101111011001011110110110101110001010010111001110101001 | |
1011001101100010111000111110011101100100101001110010011000100111101011 | |
1000101010011000011010011101100001101100101110110001101111001001100011 | |
0011111011010010101110100100101100011011001111100111101011110010111101 | |
1000100110100101100101101011110111001110100111001000011011001011101100 | |
0110111100100110001100111110110100101110111010111010010000101100011011 | |
1100100101011011011010001000101100101010101110011000110000101111111111 | |
1111111111111111111111111111111111111111111111111111111111111111111111 | |
""".replace("\n", "") | |
def main(): | |
bits = DATA.translate(str.maketrans('01', '10')) | |
num_bytes = len(bits) // 8 | |
sb = [] | |
for i in range(num_bytes): | |
piece = bits[i*8:i*8+8] | |
letter = chr(int(piece, 2)) | |
if letter != '\0': | |
sb.append(letter) | |
# | |
b64 = "".join(sb) | |
text = base64.b64decode(b64.encode()).decode() | |
print(text) | |
############################################################################## | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment