资源简介
利用DES对图像进行加密,python2.7版本(注:加密的图像必须是24位的)
代码片段和文件信息
import binascii os.path urllib random
import PIL.Image
from Crypto.Cipher import DES
class ECBPenguin(object):
‘‘‘
A penguin class
‘‘‘
def __init__(self img_clr=““):
if not img_clr:
self.__demo_image__()
self.img_clr = “gun.bmp“
else:
self.img_clr = img_clr
self.__get_header__()
def __demo_image__(self):
‘‘‘
Downloads a TUX image compatible for this program: square and with size multiple of 16
‘‘‘
#print “Downloading image...“
#image = urllib.URLopener()
#image.retrieve(“https://www.polyvore.com/batman_symbol.bmp_bmp_image_300x188/thing?id=3913862““tux_clear.bmp“)
def __get_sizes__(self dibheader):
# Get image‘s dim
评论
共有 条评论