资源简介
matlab开发-该算法基于密钥对图像进行解密和加密。
代码片段和文件信息
%%
% Purpose:
%
% This algorithm decrypts and encrypts images based on keys
%
% INPUTS:
%
%
%
% imMat: If the nargin is one imMat is the filename of the image which
% you would like to encrypt. If the nargin is 4 imMat is the encrypted
% matrix
%
% key1 key2 key3: These are number values used to encrypt and decrypt
% images.
% key3 and key2 and key1 can be left blank if the nargin is one and you would like
% the computer to make the keys for you. if the nargin is 4 key1 is
% a vector at baseto that is the encrypted vector of the original random numbers.
% key2 is the base of the original vector (baseKey) **Please
% read the help section of baseVecExpand.
%
% OUTPUTS:
%
% cryptPic: If the nargin = 1 cryptPic is a matrix of encrypted
% numbers representing an encrypted image. If the nargin = 4 imMat
% is a uint8 array which is a decrypted image. This function will also
% display the decrypted image.
%
% keyVec: If the nargin = 1 the computer will use the random number generator to
% make three keys. These three keys are then changed to a random base baseto
% using baseVecExpand. The starting base is baseKey.
% keyVec is a vector containing the key vector at baseto. if nargin = 4
% keyVec is not returned
%
% baseKey: If the nargin = 1 baseKey is the base of the
% original vector. please read the help section of baseVecExpand. baseKey
% is not returned if the nargin = 4.
%
% COMMENTS:
%
% Please change the formulas used to encrypt and decrypt the images into
% your own unique formulas so that nobody can see your images.
function [cryptPic keyVec baseto baseKey] = picCrypt(imMatkeykey2key3)
if nargin == 1
key = rand;
key2 = rand;
key3 = rand;
baseto = rand*1000;
baseKey = max(floor(1000000*[key key2 key3])) + rand*100;
keyVec = baseVecExpand(floor(1000000*[key key2 key3])baseKeybaseto);
pic = 10000*im2double(imread(imMat));
cryptPic = ((floor(pic)/key2).^key)+key3;
imagesc(im2uint8(cryptPic));
axis equal;
axis tight;
elseif nargin == 4
key10 = baseVecExpand(keykey3key2)/1000000;
cryptPic = im2uint8(((imMat - key10(3)).^(1/key10(1))*key10(2))/10000); % CHANGE THIS FORMULA (this is the opposite of the formula above
imagesc(cryptPic);
axis equal;
axis tight;
else
error(‘You must enter the correct number of parameters‘);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2403 2011-02-17 05:02 picCrypt.m
文件 1316 2014-02-12 13:26 license.txt
相关资源
- matlab开发-经济调度通用算法解决方案
- matlab开发-分子通讯粘着剂
- matlab开发-IEEE754二进制表示
- matlab开发-kmvcreditriskmodel违约风险概率
- matlab开发-17电平模块多电平转换器
- matlab开发-Xfoilformatlab
- matlab开发-脑瘤的分割
- matlab开发-车辆网络工具箱支持kvaser和
- matlab开发-CryoSat2DEMs
- matlab开发-BlandAltmanplot
- matlab开发-使用PSO的最佳模糊控制器
- matlab开发-电机磁轴承
- matlab开发-Treynorblackportfoliomanagement模型
- matlab开发-黑白图像增强器
- matlab开发-二维波动方程模拟
- matlab开发-ResponseSpectra
- matlab开发-huashiyiqikeLSTMMATLAB
- matlab开发-HestonOptionPricer
- matlab开发-三相电压调节器
- matlab开发-单级电液伺服阀
-
matlab开发-iau2006 acioba
sedDusingXy系列 - matlab开发-带DPWM0调制的三相逆变器
- matlab开发-Earthquakesimulation
- matlab开发-带MPPT的住宅网格连接PVSys
- matlab开发-pplot
评论
共有 条评论