资源简介
用python实现了图像的混沌加密与解密,是参考某位大佬博客上面的用matlab实现了的加密解密算法
代码片段和文件信息
from PIL import Image
import numpy as np
import math
“““
作者: RyanChen
创建日期: 2018/10/26
描述: python实现图像的混沌加密
参考: https://blog.csdn.net/u013626386/article/details/39736611
https://blog.csdn.net/hust_bochu_xuchao/article/details/52687755
“““
def ImageEncrypt(image):
image=np.array(image.convert(‘L‘))
width=image.shape[0]
height=image.shape[1]
A1=np.zeros((width height)dtype=np.uint8)
A2=np.zeros((width height)dtype=np.uint8)
u1=4
u2=4
x1=np.zeros(width*height)
x1[0]=0.2
x2=np.zeros(width*height)
x2[0]=0.7
y1=np.zeros(width*height)
y2=np.zeros(width*height)
sumA=sum(sum(image))
k=np.mod(sumA256)*1.0/255
x1[0]=(x1[0]+k)/2
x2[0]=(x2[0]+k)/2
y1[0]=((1/3.1415926)*math.asin(np.sqrt(x1[0])))
y2[0]=((1/3.1415926)*math.asin(np.sqrt(x2[0])))
for i in range(0width*height-1):
x1[i+1]=u1*x1[i]*(1-x1[i])
x2[i+1]=u2*x2[i]*(1-x2[i])
fo
- 上一篇:think python 中文版.pdf
- 下一篇:基于决策树的天气大数据回归例程
相关资源
- Python-BDD100K大规模多样化驾驶视频数据
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
评论
共有 条评论