資源簡介
利用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
評論
共有 條評論