I have two files ctext0 and ctext1 that are byte files and they are encoded using the same one time pad, so I tried to write a pygame program to allow me to use crib-dragging to figure out some words like so:
import pygame
import sys
import os
file_size1 = os.path.getsize('ctext0')
file_size2 = os.path.getsize('ctext1')
pygame.init()
# Load the byte files
with open('ctext0', 'rb') as f0:
ctext0 = f0.read()
with open('ctext1', 'rb') as f1:
ctext1 = f1.read()
# Create the window
window = pygame.display.set_mode((800, 600))
# Main loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Draw the byte files
image0 = pygame.image.frombuffer(ctext0, (file_size1 // 3, file_size1 // 3), 'RGB', False)
image1 = pygame.image.frombuffer(ctext1, (file_size2 // 3, file_size2 // 3), 'RGB', False)
window.blit(image0, (0, 0))
window.blit(image1, (100, 0))
# Update the display
pygame.display.update()
However this program just opens a black screen and immediately exits the program. With the following printed to the terminal:
pygame 2.5.0 (SDL 2.28.0, Python 3.11.3)
Hello from the pygame community. https://www.pygame.org/contribute.html