Please, for the love of all that is good in this world, do not use this for cryptography. Except the cryptography class. Let's all use this for the cryptography class.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
646 B

#!/usr/bin/python3
import requests
import cv2
import shutil
API = "http://localhost:5000/api/"
def send(bit):
if bit == "1":
requests.get(API + "one")
elif bit == "0":
requests.get(API + "zero")
def thermal_entropy():
url = 'http://the-internet.cosi.clarkson.edu/thermal.jpg'
response = requests.get(url, stream=True)
with open('thermal.jpg', 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
im = cv2.imread('thermal.jpg')
h,w,_ = im.shape
pixl = im[w//2,h//2]
for i in pixl:
b = "{0:b}".format(i)
for bit in b:
send(bit)
thermal_entropy()