Skip to content

Instantly share code, notes, and snippets.

@aminzabardast
aminzabardast / kpa.py
Created May 8, 2024 21:56
Example of Known Plain-text Attack (KPA) to break Vigenère's Cipher
"""
Using Known Plain-text Attack (KPA) to break Vigenère's Cipher
Check the following link to know more about the Vigenère's Cipher, including how to use KPA to break the encryption.
https://www.commonlounge.com/vigeneres-cipher-b27ffb470c3a4d2b83378edee0a55dab/
"""
import re
import string
@aminzabardast
aminzabardast / IO.py
Created July 24, 2019 22:42
IO library to read and write images, flows, and disparities
import os
import re
import numpy as np
import uuid
from scipy import misc
import numpy as np
from PIL import Image
import sys
import numpy as np
import re
import sys
'''
Read a PFM file into a Numpy array. Note that it will have
a shape of H x W, not W x H. Returns a tuple containing the
loaded image and the scale factor from the file.
'''
def read_pfm(file):